Revision b8b112a3
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
SL/DB/MetaSetup/Note.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use base qw(SL::DB::Object); |
8 | 8 |
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'notes', |
|
11 |
|
|
12 |
columns => [ |
|
13 |
id => { type => 'integer', not_null => 1, sequence => 'note_id' }, |
|
14 |
subject => { type => 'text' }, |
|
15 |
body => { type => 'text' }, |
|
16 |
created_by => { type => 'integer', not_null => 1 }, |
|
17 |
trans_id => { type => 'integer' }, |
|
18 |
trans_module => { type => 'varchar', length => 10 }, |
|
19 |
itime => { type => 'timestamp', default => 'now()' }, |
|
20 |
mtime => { type => 'timestamp' }, |
|
21 |
], |
|
22 |
|
|
23 |
primary_key_columns => [ 'id' ], |
|
24 |
|
|
25 |
allow_inline_column_values => 1, |
|
26 |
|
|
27 |
foreign_keys => [ |
|
28 |
employee => { |
|
29 |
class => 'SL::DB::Employee', |
|
30 |
key_columns => { created_by => 'id' }, |
|
31 |
}, |
|
32 |
], |
|
9 |
__PACKAGE__->meta->table('notes'); |
|
10 |
|
|
11 |
__PACKAGE__->meta->columns( |
|
12 |
id => { type => 'integer', not_null => 1, sequence => 'note_id' }, |
|
13 |
subject => { type => 'text' }, |
|
14 |
body => { type => 'text' }, |
|
15 |
created_by => { type => 'integer', not_null => 1 }, |
|
16 |
trans_id => { type => 'integer' }, |
|
17 |
trans_module => { type => 'varchar', length => 10 }, |
|
18 |
itime => { type => 'timestamp', default => 'now()' }, |
|
19 |
mtime => { type => 'timestamp' }, |
|
33 | 20 |
); |
34 | 21 |
|
22 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
|
23 |
|
|
24 |
__PACKAGE__->meta->allow_inline_column_values(1); |
|
25 |
|
|
26 |
__PACKAGE__->meta->foreign_keys( |
|
27 |
employee => { |
|
28 |
class => 'SL::DB::Employee', |
|
29 |
key_columns => { created_by => 'id' }, |
|
30 |
}, |
|
31 |
); |
|
32 |
|
|
33 |
__PACKAGE__->meta->relationships( |
|
34 |
follow_ups => { |
|
35 |
class => 'SL::DB::FollowUp', |
|
36 |
column_map => { id => 'note_id' }, |
|
37 |
type => 'one to many', |
|
38 |
}, |
|
39 |
); |
|
40 |
|
|
41 |
# __PACKAGE__->meta->initialize; |
|
42 |
|
|
35 | 43 |
1; |
36 | 44 |
; |
Auch abrufbar als: Unified diff
MetaSetup neu generiert