From 5a5c148a837d1f4e1677842f07665de733386a52 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 11 May 2020 11:39:00 +0100 Subject: [PATCH] Bug 25389: Catch errant cases of LOST_RETURNED For upgrades taking place after the fix for the update in bug 24592 was pushed, we need to catch any last remaining error cases and correct them. Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- .../data/mysql/atomicupdate/bug_25389.perl | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_25389.perl diff --git a/installer/data/mysql/atomicupdate/bug_25389.perl b/installer/data/mysql/atomicupdate/bug_25389.perl new file mode 100644 index 0000000000..722a4bfacc --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25389.perl @@ -0,0 +1,20 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + # Migrate LOST_RETURNED to LOST_FOUND + $dbh->do(qq{ + UPDATE + accountlines + SET + credit_type_code = 'LOST_FOUND' + WHERE + credit_type_code = 'LOST_RETURNED' + }); + + # Drop LOST_RETURNED credit type + $dbh->do(qq{ + DELETE FROM account_credit_types WHERE code = 'LOST_RETURNED' + }); + + NewVersion( $DBversion, 25389, "Catch errant cases of LOST_RETURNED"); +} -- 2.20.1