From: Jan Büren Date: Thu, 6 Oct 2011 16:47:06 +0000 (+0200) Subject: Verwaiste Zahlungsbedingungen in vc vorher auf NULL setzen und danach den neuen Fremd... X-Git-Tag: release-2.7.0beta1~240^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e05b8d340be3f8b7516ae37f4532977d3860c10d;p=kivitendo-erp.git Verwaiste Zahlungsbedingungen in vc vorher auf NULL setzen und danach den neuen Fremdschlüssel --- diff --git a/sql/Pg-upgrade2/customer_add_constraints.sql b/sql/Pg-upgrade2/customer_add_constraints.sql index 6505efdb1..89ca9d628 100644 --- a/sql/Pg-upgrade2/customer_add_constraints.sql +++ b/sql/Pg-upgrade2/customer_add_constraints.sql @@ -4,6 +4,9 @@ -- @charset: utf-8 -- @ignore: 0 +-- verwaiste Zahlungsbedingungen vorher entfernen: +update customer set payment_id = NULL where payment_id not in (select id from payment_terms); + ALTER TABLE customer ADD FOREIGN KEY (payment_id) REFERENCES payment_terms (id); ALTER TABLE customer ADD FOREIGN KEY (language_id) REFERENCES language (id); ALTER TABLE customer ADD FOREIGN KEY (business_id) REFERENCES business (id); diff --git a/sql/Pg-upgrade2/vendor_add_constraints.sql b/sql/Pg-upgrade2/vendor_add_constraints.sql index 7b707c0fa..3d3a81657 100644 --- a/sql/Pg-upgrade2/vendor_add_constraints.sql +++ b/sql/Pg-upgrade2/vendor_add_constraints.sql @@ -4,6 +4,10 @@ -- @charset: utf-8 -- @ignore: 0 +-- verwaiste Zahlungsbedingungen vorher entfernen +update vendor set payment_id = NULL where payment_id not in (select id from payment_terms); + + ALTER TABLE vendor ADD FOREIGN KEY (payment_id) REFERENCES payment_terms (id); ALTER TABLE vendor ADD FOREIGN KEY (language_id) REFERENCES language (id); ALTER TABLE vendor ADD FOREIGN KEY (business_id) REFERENCES business (id);