X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/17041e6c31bcf9d4019097dd32814f394e273c8f..7196276bca4a155d1bcc3947859bc7d4ec1edcd6:/sql/Pg-upgrade2/letter_cleanup.sql

diff --git a/sql/Pg-upgrade2/letter_cleanup.sql b/sql/Pg-upgrade2/letter_cleanup.sql
new file mode 100644
index 000000000..e87f6e028
--- /dev/null
+++ b/sql/Pg-upgrade2/letter_cleanup.sql
@@ -0,0 +1,40 @@
+-- @tag: letter_cleanup
+-- @description: Tabelle Â»letterÂ«: Unbenutzte Spalten entfernen und andere Spalten umbenennen
+-- @depends: release_3_4_0
+
+ALTER TABLE letter       RENAME COLUMN vc_id TO customer_id;
+ALTER TABLE letter_draft RENAME COLUMN vc_id TO customer_id;
+
+ALTER TABLE letter
+  DROP COLUMN close,
+  DROP COLUMN company_name,
+  DROP COLUMN employee_position,
+  DROP COLUMN jobnumber,
+  DROP COLUMN page_created_for,
+  DROP COLUMN rcv_address,
+  DROP COLUMN rcv_city,
+  DROP COLUMN rcv_contact,
+  DROP COLUMN rcv_country,
+  DROP COLUMN rcv_countrycode,
+  DROP COLUMN rcv_name,
+  DROP COLUMN rcv_zipcode,
+  DROP COLUMN salesman_position,
+  DROP COLUMN text_created_for,
+  ADD FOREIGN KEY (customer_id) REFERENCES customer (id);
+
+ALTER TABLE letter_draft
+  DROP COLUMN close,
+  DROP COLUMN company_name,
+  DROP COLUMN employee_position,
+  DROP COLUMN jobnumber,
+  DROP COLUMN page_created_for,
+  DROP COLUMN rcv_address,
+  DROP COLUMN rcv_city,
+  DROP COLUMN rcv_contact,
+  DROP COLUMN rcv_country,
+  DROP COLUMN rcv_countrycode,
+  DROP COLUMN rcv_name,
+  DROP COLUMN rcv_zipcode,
+  DROP COLUMN salesman_position,
+  DROP COLUMN text_created_for,
+  ADD FOREIGN KEY (customer_id) REFERENCES customer (id);
