From 27fb90a253b3806e5a2931b8aa4c232048b508f2 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 16 Mar 2021 17:28:12 +0000 Subject: [PATCH] Bug 22435: Update CREATE offset types Signed-off-by: Victor Grousset/tuxayo --- installer/data/mysql/atomicupdate/bug_22435.perl | 8 ++++++++ installer/data/mysql/mandatory/account_offset_types.sql | 1 + 2 files changed, 9 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_22435.perl diff --git a/installer/data/mysql/atomicupdate/bug_22435.perl b/installer/data/mysql/atomicupdate/bug_22435.perl new file mode 100644 index 0000000000..3839c23002 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22435.perl @@ -0,0 +1,8 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "INSERT IGNORE INTO account_offset_types () VALUES ( 'CREATE' )" ); + $dbh->do( "UPDATE account_offsets SET type = 'CREATE' WHERE type != 'OVERDUE_INCREASE' AND type != 'OVERDUE_DECREASE' AND ( debit_id IS NULL OR credit_id IS NULL)" ); + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 22435, "Update offsets to CREATE type"); +} diff --git a/installer/data/mysql/mandatory/account_offset_types.sql b/installer/data/mysql/mandatory/account_offset_types.sql index 040135b9f9..c608ecd21f 100644 --- a/installer/data/mysql/mandatory/account_offset_types.sql +++ b/installer/data/mysql/mandatory/account_offset_types.sql @@ -1,4 +1,5 @@ INSERT INTO account_offset_types ( type ) VALUES +('CREATE'), ('Writeoff'), ('Payment'), ('Purchase'), -- 2.32.0