From 6b353ee1ed1d405484609e02cbb8174e45641bd1 Mon Sep 17 00:00:00 2001 From: Cem Aydin Date: Wed, 15 Dec 2021 16:38:28 +0100 Subject: [PATCH] Swiss QR-Bill: Datenbankupgrade BankAccount MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Felder bank_account_id und use_for_qrbill hinzugefügt --- SL/DB/MetaSetup/BankAccount.pm | 2 ++ .../bank_account_informations_for_swiss_qrbill.sql | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 sql/Pg-upgrade2/bank_account_informations_for_swiss_qrbill.sql diff --git a/SL/DB/MetaSetup/BankAccount.pm b/SL/DB/MetaSetup/BankAccount.pm index 5589ee43d..d8367789f 100644 --- a/SL/DB/MetaSetup/BankAccount.pm +++ b/SL/DB/MetaSetup/BankAccount.pm @@ -11,6 +11,7 @@ __PACKAGE__->meta->table('bank_accounts'); __PACKAGE__->meta->columns( account_number => { type => 'varchar', length => 100 }, bank => { type => 'text' }, + bank_account_id => { type => 'varchar' }, bank_code => { type => 'varchar', length => 100 }, bic => { type => 'varchar', length => 100 }, chart_id => { type => 'integer', not_null => 1 }, @@ -21,6 +22,7 @@ __PACKAGE__->meta->columns( reconciliation_starting_balance => { type => 'numeric', precision => 15, scale => 5 }, reconciliation_starting_date => { type => 'date' }, sortkey => { type => 'integer', not_null => 1 }, + use_for_qrbill => { type => 'boolean', default => 'false', not_null => 1 }, use_for_zugferd => { type => 'boolean', default => 'false', not_null => 1 }, ); diff --git a/sql/Pg-upgrade2/bank_account_informations_for_swiss_qrbill.sql b/sql/Pg-upgrade2/bank_account_informations_for_swiss_qrbill.sql new file mode 100644 index 000000000..0c8c64c4f --- /dev/null +++ b/sql/Pg-upgrade2/bank_account_informations_for_swiss_qrbill.sql @@ -0,0 +1,14 @@ +-- @tag: bank_account_information_for_swiss_qrbill +-- @description: Bankkonto Informationen für Swiss QR-Bill hinzufügen +-- @depends: release_3_5_6_1 +ALTER TABLE bank_accounts ADD COLUMN use_for_qrbill BOOLEAN; +ALTER TABLE bank_accounts ADD COLUMN bank_account_id VARCHAR; + +UPDATE bank_accounts SET use_for_qrbill = ( + SELECT COUNT(*) + FROM bank_accounts + ) = 1; + +ALTER TABLE bank_accounts + ALTER COLUMN use_for_qrbill SET DEFAULT FALSE, + ALTER COLUMN use_for_qrbill SET NOT NULL; -- 2.20.1