Revision b8b112a3
Von Sven Schöling vor mehr als 11 Jahren hinzugefügt
SL/DB/MetaSetup/Part.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use base qw(SL::DB::Object); |
8 | 8 |
|
9 |
__PACKAGE__->meta->setup( |
|
10 |
table => 'parts', |
|
9 |
__PACKAGE__->meta->table('parts'); |
|
11 | 10 |
|
12 |
columns => [ |
|
13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
14 |
partnumber => { type => 'text', not_null => 1 }, |
|
15 |
description => { type => 'text' }, |
|
16 |
listprice => { type => 'numeric', precision => 5, scale => 15 }, |
|
17 |
sellprice => { type => 'numeric', precision => 5, scale => 15 }, |
|
18 |
lastcost => { type => 'numeric', precision => 5, scale => 15 }, |
|
19 |
priceupdate => { type => 'date', default => 'now' }, |
|
20 |
weight => { type => 'float', precision => 4 }, |
|
21 |
notes => { type => 'text' }, |
|
22 |
makemodel => { type => 'boolean', default => 'false' }, |
|
23 |
assembly => { type => 'boolean', default => 'false' }, |
|
24 |
alternate => { type => 'boolean', default => 'false' }, |
|
25 |
rop => { type => 'float', precision => 4 }, |
|
26 |
inventory_accno_id => { type => 'integer' }, |
|
27 |
income_accno_id => { type => 'integer' }, |
|
28 |
expense_accno_id => { type => 'integer' }, |
|
29 |
shop => { type => 'boolean', default => 'false' }, |
|
30 |
obsolete => { type => 'boolean', default => 'false' }, |
|
31 |
bom => { type => 'boolean', default => 'false' }, |
|
32 |
image => { type => 'text' }, |
|
33 |
drawing => { type => 'text' }, |
|
34 |
microfiche => { type => 'text' }, |
|
35 |
partsgroup_id => { type => 'integer' }, |
|
36 |
ve => { type => 'integer' }, |
|
37 |
gv => { type => 'numeric', precision => 5, scale => 15 }, |
|
38 |
itime => { type => 'timestamp', default => 'now()' }, |
|
39 |
mtime => { type => 'timestamp' }, |
|
40 |
unit => { type => 'varchar', length => 20, not_null => 1 }, |
|
41 |
formel => { type => 'text' }, |
|
42 |
not_discountable => { type => 'boolean', default => 'false' }, |
|
43 |
buchungsgruppen_id => { type => 'integer' }, |
|
44 |
payment_id => { type => 'integer' }, |
|
45 |
ean => { type => 'text' }, |
|
46 |
price_factor_id => { type => 'integer' }, |
|
47 |
onhand => { type => 'numeric', default => '0', precision => 5, scale => 25 }, |
|
48 |
stockable => { type => 'boolean', default => 'false' }, |
|
49 |
has_sernumber => { type => 'boolean', default => 'false' }, |
|
50 |
warehouse_id => { type => 'integer' }, |
|
51 |
bin_id => { type => 'integer' }, |
|
52 |
], |
|
53 |
|
|
54 |
primary_key_columns => [ 'id' ], |
|
55 |
|
|
56 |
allow_inline_column_values => 1, |
|
57 |
unique_key => [ 'partnumber' ], |
|
11 |
__PACKAGE__->meta->columns( |
|
12 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
|
13 |
partnumber => { type => 'text', not_null => 1 }, |
|
14 |
description => { type => 'text' }, |
|
15 |
listprice => { type => 'numeric', precision => 5, scale => 15 }, |
|
16 |
sellprice => { type => 'numeric', precision => 5, scale => 15 }, |
|
17 |
lastcost => { type => 'numeric', precision => 5, scale => 15 }, |
|
18 |
priceupdate => { type => 'date', default => 'now' }, |
|
19 |
weight => { type => 'float', precision => 4 }, |
|
20 |
notes => { type => 'text' }, |
|
21 |
makemodel => { type => 'boolean', default => 'false' }, |
|
22 |
assembly => { type => 'boolean', default => 'false' }, |
|
23 |
alternate => { type => 'boolean', default => 'false' }, |
|
24 |
rop => { type => 'float', precision => 4 }, |
|
25 |
inventory_accno_id => { type => 'integer' }, |
|
26 |
income_accno_id => { type => 'integer' }, |
|
27 |
expense_accno_id => { type => 'integer' }, |
|
28 |
shop => { type => 'boolean', default => 'false' }, |
|
29 |
obsolete => { type => 'boolean', default => 'false' }, |
|
30 |
bom => { type => 'boolean', default => 'false' }, |
|
31 |
image => { type => 'text' }, |
|
32 |
drawing => { type => 'text' }, |
|
33 |
microfiche => { type => 'text' }, |
|
34 |
partsgroup_id => { type => 'integer' }, |
|
35 |
ve => { type => 'integer' }, |
|
36 |
gv => { type => 'numeric', precision => 5, scale => 15 }, |
|
37 |
itime => { type => 'timestamp', default => 'now()' }, |
|
38 |
mtime => { type => 'timestamp' }, |
|
39 |
unit => { type => 'varchar', length => 20, not_null => 1 }, |
|
40 |
formel => { type => 'text' }, |
|
41 |
not_discountable => { type => 'boolean', default => 'false' }, |
|
42 |
buchungsgruppen_id => { type => 'integer' }, |
|
43 |
payment_id => { type => 'integer' }, |
|
44 |
ean => { type => 'text' }, |
|
45 |
price_factor_id => { type => 'integer' }, |
|
46 |
onhand => { type => 'numeric', default => '0', precision => 5, scale => 25 }, |
|
47 |
stockable => { type => 'boolean', default => 'false' }, |
|
48 |
has_sernumber => { type => 'boolean', default => 'false' }, |
|
49 |
warehouse_id => { type => 'integer' }, |
|
50 |
bin_id => { type => 'integer' }, |
|
51 |
); |
|
58 | 52 |
|
59 |
foreign_keys => [ |
|
60 |
bin => { |
|
61 |
class => 'SL::DB::Bin', |
|
62 |
key_columns => { bin_id => 'id' }, |
|
63 |
}, |
|
53 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
|
64 | 54 |
|
65 |
buchungsgruppen => { |
|
66 |
class => 'SL::DB::Buchungsgruppe', |
|
67 |
key_columns => { buchungsgruppen_id => 'id' }, |
|
68 |
}, |
|
55 |
__PACKAGE__->meta->unique_keys([ 'partnumber' ]); |
|
69 | 56 |
|
70 |
partsgroup => { |
|
71 |
class => 'SL::DB::PartsGroup', |
|
72 |
key_columns => { partsgroup_id => 'id' }, |
|
73 |
}, |
|
57 |
__PACKAGE__->meta->allow_inline_column_values(1); |
|
74 | 58 |
|
75 |
payment => { |
|
76 |
class => 'SL::DB::PaymentTerm', |
|
77 |
key_columns => { payment_id => 'id' }, |
|
78 |
}, |
|
59 |
__PACKAGE__->meta->foreign_keys( |
|
60 |
bin => { |
|
61 |
class => 'SL::DB::Bin', |
|
62 |
key_columns => { bin_id => 'id' }, |
|
63 |
}, |
|
79 | 64 |
|
80 |
price_factor => {
|
|
81 |
class => 'SL::DB::PriceFactor',
|
|
82 |
key_columns => { price_factor_id => 'id' },
|
|
83 |
},
|
|
65 |
buchungsgruppen => {
|
|
66 |
class => 'SL::DB::Buchungsgruppe',
|
|
67 |
key_columns => { buchungsgruppen_id => 'id' },
|
|
68 |
}, |
|
84 | 69 |
|
85 |
unit_obj => {
|
|
86 |
class => 'SL::DB::Unit',
|
|
87 |
key_columns => { unit => 'name' },
|
|
88 |
},
|
|
70 |
unit_obj => { |
|
71 |
class => 'SL::DB::Unit', |
|
72 |
key_columns => { unit => 'name' }, |
|
73 |
}, |
|
89 | 74 |
|
90 |
warehouse => { |
|
91 |
class => 'SL::DB::Warehouse', |
|
92 |
key_columns => { warehouse_id => 'id' }, |
|
93 |
}, |
|
94 |
], |
|
75 |
warehouse => { |
|
76 |
class => 'SL::DB::Warehouse', |
|
77 |
key_columns => { warehouse_id => 'id' }, |
|
78 |
}, |
|
95 | 79 |
); |
96 | 80 |
|
81 |
# __PACKAGE__->meta->initialize; |
|
82 |
|
|
97 | 83 |
1; |
98 | 84 |
; |
Auch abrufbar als: Unified diff
MetaSetup neu generiert