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

diff --git a/sql/Pg-upgrade2/defaults_add_rnd_accno_ids.sql b/sql/Pg-upgrade2/defaults_add_rnd_accno_ids.sql
new file mode 100644
index 000000000..9798dcdb2
--- /dev/null
+++ b/sql/Pg-upgrade2/defaults_add_rnd_accno_ids.sql
@@ -0,0 +1,10 @@
+-- @tag: defaults_add_rnd_accno_ids
+-- @description: adds new columns 'rndgain_accno_id' and 'rndloss_accno_id' in table defaults, used to book roundings
+-- @depends: release_3_1_0
+ALTER TABLE defaults ADD COLUMN rndgain_accno_id Integer;
+ALTER TABLE defaults ADD COLUMN rndloss_accno_id Integer;
+UPDATE defaults SET ( rndgain_accno_id , rndloss_accno_id ) = (
+  (SELECT id FROM chart WHERE accno = '6953' LIMIT 1),
+  (SELECT id FROM chart WHERE accno = '6943' LIMIT 1)
+) WHERE coa LIKE 'Switzerland%';
+
