X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44..53593baa211863fbf66540cf1bcc36c8fb37257f:/sql/Pg-upgrade2/periodic_invoices_send_email.sql

diff --git a/sql/Pg-upgrade2/periodic_invoices_send_email.sql b/sql/Pg-upgrade2/periodic_invoices_send_email.sql
new file mode 100644
index 000000000..91eab25ec
--- /dev/null
+++ b/sql/Pg-upgrade2/periodic_invoices_send_email.sql
@@ -0,0 +1,18 @@
+-- @tag: periodic_invoices_send_email
+-- @description: Wiederkehrende Rechnungen automatisch per E-Mail verschicken
+-- @depends: release_3_4_0
+ALTER TABLE periodic_invoices_configs ADD COLUMN send_email                 BOOLEAN;
+ALTER TABLE periodic_invoices_configs ADD COLUMN email_recipient_contact_id INTEGER;
+ALTER TABLE periodic_invoices_configs ADD COLUMN email_recipient_address    TEXT;
+ALTER TABLE periodic_invoices_configs ADD COLUMN email_sender               TEXT;
+ALTER TABLE periodic_invoices_configs ADD COLUMN email_subject              TEXT;
+ALTER TABLE periodic_invoices_configs ADD COLUMN email_body                 TEXT;
+
+UPDATE periodic_invoices_configs SET send_email = FALSE;
+
+ALTER TABLE periodic_invoices_configs ALTER COLUMN send_email SET DEFAULT FALSE;
+ALTER TABLE periodic_invoices_configs ALTER COLUMN send_email SET NOT NULL;
+
+ALTER TABLE periodic_invoices_configs
+ADD FOREIGN KEY (email_recipient_contact_id) REFERENCES contacts (cp_id)
+ON DELETE SET NULL;
