Revision 51ff8011
Von Sven Schöling vor etwa 13 Jahren hinzugefügt
SL/DB/MetaSetup/Order.pm | ||
---|---|---|
53 | 53 |
allow_inline_column_values => 1, |
54 | 54 |
|
55 | 55 |
foreign_keys => [ |
56 |
customer => { |
|
57 |
class => 'SL::DB::Customer', |
|
58 |
key_columns => { customer_id => 'id' }, |
|
59 |
}, |
|
60 |
|
|
56 | 61 |
employee => { |
57 | 62 |
class => 'SL::DB::Employee', |
58 | 63 |
key_columns => { employee_id => 'id' }, |
... | ... | |
67 | 72 |
class => 'SL::DB::Employee', |
68 | 73 |
key_columns => { salesman_id => 'id' }, |
69 | 74 |
}, |
75 |
|
|
76 |
vendor => { |
|
77 |
class => 'SL::DB::Vendor', |
|
78 |
key_columns => { vendor_id => 'id' }, |
|
79 |
}, |
|
70 | 80 |
], |
71 | 81 |
); |
72 | 82 |
|
sql/Pg-upgrade2/oe_customer_vendor_fkeys.sql | ||
---|---|---|
1 |
-- @tag: oe_customer_vendor_fkeys |
|
2 |
-- @encoding: utf-8 |
|
3 |
-- @description: Foreign Keys für customer und vendor in oe |
|
4 |
-- @depends: release_2_6_3 |
|
5 |
-- @timestamp: 1317380460 |
|
6 |
UPDATE oe SET customer_id = NULL WHERE customer_id = 0; |
|
7 |
UPDATE oe SET vendor_id = NULL WHERE vendor_id = 0; |
|
8 |
|
|
9 |
|
|
10 |
ALTER TABLE oe ADD FOREIGN KEY (customer_id) REFERENCES customer(id); |
|
11 |
ALTER TABLE oe ADD FOREIGN KEY (vendor_id) REFERENCES vendor(id); |
Auch abrufbar als: Unified diff
customer vendor in oe mit foreign keys sichern.