X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/b67471a15a2334cd0ce4f617c962819889c487f9..3b9a530196e7ecadfd5f8708d2f0025dda4613c7:/sql/Pg-upgrade2/vendor_add_constraints.sql?ds=inline

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);
