Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / sql / Pg-upgrade2 / re_add_sepa_export_items_foreign_keys.sql
1 -- @tag: re_add_sepa_export_items_foreign_keys
2 -- @description: Versehentlich gelöschte Fremdschlüssel in sepa_export_items wieder hinzufügen
3 -- @depends: auto_delete_sepa_export_items_on_ap_ar_deletion
4 ALTER TABLE sepa_export_items
5   DROP CONSTRAINT IF EXISTS sepa_export_items_chart_id_fkey,
6   ADD CONSTRAINT sepa_export_items_chart_id_fkey
7     FOREIGN KEY (chart_id) REFERENCES chart (id);
8
9 ALTER TABLE sepa_export_items
10   DROP CONSTRAINT IF EXISTS sepa_export_items_sepa_export_id_fkey,
11   ADD CONSTRAINT sepa_export_items_sepa_export_id_fkey
12     FOREIGN KEY (sepa_export_id) REFERENCES sepa_export (id)
13     ON DELETE CASCADE;