SEPA: Feld »Signaturdatum«; Bearbeiten der Felder in Stammdatenmasken; Speichern...
[kivitendo-erp.git] / sql / Pg-upgrade2 / add_customer_mandator_id.sql
1 -- @tag: add_customer_mandator_id
2 -- @description: Einführen einer Mandanten-ID- und Signatur-Datums-Spalte bei Kunden.
3 -- @depends: release_3_0_0
4
5 ALTER TABLE customer          ADD COLUMN mandator_id                  text;
6 ALTER TABLE customer          ADD COLUMN mandate_date_of_signature    date;
7 ALTER TABLE sepa_export_items ADD COLUMN vc_mandator_id               text;
8 ALTER TABLE sepa_export_items ADD COLUMN vc_mandate_date_of_signature date;
9
10 UPDATE sepa_export_items
11 SET vc_mandator_id = (
12   SELECT c.customernumber
13   FROM ar
14   LEFT JOIN customer c ON (ar.customer_id = c.id)
15   WHERE ar.id = sepa_export_items.ar_id
16 ),
17 vc_mandate_date_of_signature = '2010-01-01'::date
18 WHERE ar_id IS NOT NULL;