Revision b8b112a3
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
SL/DB/MetaSetup/Employee.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use base qw(SL::DB::Object); |
8 | 8 |
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'employee', |
|
11 |
|
|
12 |
columns => [ |
|
13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
14 |
login => { type => 'text' }, |
|
15 |
startdate => { type => 'date', default => 'now' }, |
|
16 |
enddate => { type => 'date' }, |
|
17 |
notes => { type => 'text' }, |
|
18 |
sales => { type => 'boolean', default => 'true' }, |
|
19 |
itime => { type => 'timestamp', default => 'now()' }, |
|
20 |
mtime => { type => 'timestamp' }, |
|
21 |
name => { type => 'text' }, |
|
22 |
addr1 => { type => 'text' }, |
|
23 |
addr2 => { type => 'text' }, |
|
24 |
addr3 => { type => 'text' }, |
|
25 |
addr4 => { type => 'text' }, |
|
26 |
homephone => { type => 'text' }, |
|
27 |
workphone => { type => 'text' }, |
|
28 |
deleted => { type => 'boolean', default => 'false' }, |
|
29 |
], |
|
30 |
|
|
31 |
primary_key_columns => [ 'id' ], |
|
32 |
|
|
33 |
unique_key => [ 'login' ], |
|
34 |
|
|
35 |
allow_inline_column_values => 1, |
|
9 |
__PACKAGE__->meta->table('employee'); |
|
10 |
|
|
11 |
__PACKAGE__->meta->columns( |
|
12 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
13 |
login => { type => 'text' }, |
|
14 |
startdate => { type => 'date', default => 'now' }, |
|
15 |
enddate => { type => 'date' }, |
|
16 |
notes => { type => 'text' }, |
|
17 |
sales => { type => 'boolean', default => 'true' }, |
|
18 |
itime => { type => 'timestamp', default => 'now()' }, |
|
19 |
mtime => { type => 'timestamp' }, |
|
20 |
name => { type => 'text' }, |
|
21 |
addr1 => { type => 'text' }, |
|
22 |
addr2 => { type => 'text' }, |
|
23 |
addr3 => { type => 'text' }, |
|
24 |
addr4 => { type => 'text' }, |
|
25 |
homephone => { type => 'text' }, |
|
26 |
workphone => { type => 'text' }, |
|
27 |
deleted => { type => 'boolean', default => 'false' }, |
|
28 |
); |
|
29 |
|
|
30 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
|
31 |
|
|
32 |
__PACKAGE__->meta->unique_keys([ 'login' ]); |
|
33 |
|
|
34 |
__PACKAGE__->meta->allow_inline_column_values(1); |
|
35 |
|
|
36 |
__PACKAGE__->meta->relationships( |
|
37 |
ap => { |
|
38 |
class => 'SL::DB::PurchaseInvoice', |
|
39 |
column_map => { id => 'employee_id' }, |
|
40 |
type => 'one to many', |
|
41 |
}, |
|
42 |
|
|
43 |
ar => { |
|
44 |
class => 'SL::DB::Invoice', |
|
45 |
column_map => { id => 'employee_id' }, |
|
46 |
type => 'one to many', |
|
47 |
}, |
|
48 |
|
|
49 |
ar_objs => { |
|
50 |
class => 'SL::DB::Invoice', |
|
51 |
column_map => { id => 'salesman_id' }, |
|
52 |
type => 'one to many', |
|
53 |
}, |
|
54 |
|
|
55 |
drafts => { |
|
56 |
class => 'SL::DB::Draft', |
|
57 |
column_map => { id => 'employee_id' }, |
|
58 |
type => 'one to many', |
|
59 |
}, |
|
36 | 60 |
); |
37 | 61 |
|
62 |
# __PACKAGE__->meta->initialize; |
|
63 |
|
|
38 | 64 |
1; |
39 | 65 |
; |
Auch abrufbar als: Unified diff
MetaSetup neu generiert