From 98740d8ca993f99539777a582088c6452fc4abdf Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 11 Jul 2022 16:18:25 +0100 Subject: [PATCH] Bug 28854: (QA follow-up) Fix DB revision for AV's above 10 The authorised_value field is a varchar and so 'MAX' will sort '9' above '10' and cause issues if you have more than 9 AV values already for LOST or NOT_LOAN. This patch adds a 'CAST' to the field so we can use MAX correctly. Signed-off-by: Kyle M Hall --- installer/data/mysql/atomicupdate/bug_28854.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_28854.pl b/installer/data/mysql/atomicupdate/bug_28854.pl index d93fa9f49e0..2749f163d7e 100755 --- a/installer/data/mysql/atomicupdate/bug_28854.pl +++ b/installer/data/mysql/atomicupdate/bug_28854.pl @@ -21,7 +21,7 @@ return { } say $out "item_bundles table added"; - my ($lost_val) = $dbh->selectrow_array( "SELECT MAX(authorised_value) FROM authorised_values WHERE category = 'LOST'", {} ); + my ($lost_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'LOST'", {} ); $lost_val++; $dbh->do(qq{ @@ -29,7 +29,7 @@ return { }); say $out "Missing from bundle LOST AV added"; - my ($nfl_val) = $dbh->selectrow_array( "SELECT MAX(authorised_value) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); + my ($nfl_val) = $dbh->selectrow_array( "SELECT MAX(CAST(authorised_value AS SIGNED)) FROM authorised_values WHERE category = 'NOT_LOAN'", {} ); $nfl_val++; $dbh->do(qq{ -- 2.30.2