Revision 6f266e92
Von Moritz Bunkus vor fast 12 Jahren hinzugefügt
sql/Pg-upgrade2/orderitems_delivery_order_items_invoice_foreign_keys.sql | ||
---|---|---|
10 | 10 |
UPDATE delivery_order_items SET project_id = NULL WHERE project_id NOT IN (SELECT id FROM project); |
11 | 11 |
UPDATE invoice SET project_id = NULL WHERE project_id NOT IN (SELECT id FROM project); |
12 | 12 |
|
13 |
DELETE FROM orderitems WHERE trans_id NOT IN (SELECT id FROM oe); |
|
14 |
|
|
13 | 15 |
ALTER TABLE orderitems ADD FOREIGN KEY (trans_id) REFERENCES oe (id); |
14 | 16 |
ALTER TABLE orderitems ADD FOREIGN KEY (project_id) REFERENCES project (id); |
15 | 17 |
ALTER TABLE orderitems ADD FOREIGN KEY (pricegroup_id) REFERENCES pricegroup (id); |
Auch abrufbar als: Unified diff
Vor Fremdschlüsselzuweisung trans_id verwaiste Einträge in orderitems löschen