X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=sql%2FPg-upgrade2%2Fadd_customer_mandator_id.sql;h=99a788e92d5fb57d442b7876bdb8ab224e9e02e6;hb=b36fb0f412d2d2b43b8d98d787743cbe1fbf2540;hp=e27eba5c33eee85a9380a0079cc611291e3bcec1;hpb=66e2fdcc4f89a4f13c77f6e44f2969fd46aa7aba;p=kivitendo-erp.git diff --git a/sql/Pg-upgrade2/add_customer_mandator_id.sql b/sql/Pg-upgrade2/add_customer_mandator_id.sql index e27eba5c3..99a788e92 100644 --- a/sql/Pg-upgrade2/add_customer_mandator_id.sql +++ b/sql/Pg-upgrade2/add_customer_mandator_id.sql @@ -1,6 +1,18 @@ -- @tag: add_customer_mandator_id --- @description: Einführen einer Mandanten ID Spalte bei Kunden und Lieferanten. +-- @description: Einführen einer Mandanten-ID- und Signatur-Datums-Spalte bei Kunden. -- @depends: release_3_0_0 -ALTER TABLE customer ADD mandator_id text; -ALTER TABLE vendor ADD mandator_id text; +ALTER TABLE customer ADD COLUMN mandator_id text; +ALTER TABLE customer ADD COLUMN mandate_date_of_signature date; +ALTER TABLE sepa_export_items ADD COLUMN vc_mandator_id text; +ALTER TABLE sepa_export_items ADD COLUMN vc_mandate_date_of_signature date; + +UPDATE sepa_export_items +SET vc_mandator_id = ( + SELECT c.customernumber + FROM ar + LEFT JOIN customer c ON (ar.customer_id = c.id) + WHERE ar.id = sepa_export_items.ar_id +), +vc_mandate_date_of_signature = '2010-01-01'::date +WHERE ar_id IS NOT NULL;