From 72d88cab9e4538addd0d7e82b78b17fd2815578c Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Tue, 21 Mar 2023 22:30:21 -1000 Subject: [PATCH] Bug 33297: (follow-up) DBRev for existing databases Test plan : 1.1) Start from a Koha 22.05 1.2) Upgrade to master => Check the upgrade says : Wrong system preference 'RetainPatronSearchTerms' renamed 'RetainPatronsSearchTerms' 2.1) Start from a Koha 22.05 2.2) Upgrade to 22.11 2.3) Via interface change system preference 'RetainPatronsSearchTerms' and save 2.4) Upgrade to master => Check the upgrade says : Wrong system preference 'RetainPatronSearchTerms' deleted Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_33297.pl | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_33297.pl diff --git a/installer/data/mysql/atomicupdate/bug_33297.pl b/installer/data/mysql/atomicupdate/bug_33297.pl new file mode 100755 index 0000000000..1f94fcc98b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33297.pl @@ -0,0 +1,25 @@ +use Modern::Perl; + +return { + bug_number => "33297", + description => "Fix missing 's' in system preference 'RetainPatronSearchTerms'", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Correct preference may have been generated via interface + my ($correct_syspref_exists) = $dbh->selectrow_array(q{ + SELECT COUNT(*) FROM systempreferences WHERE variable='RetainPatronsSearchTerms' + }); + if ($correct_syspref_exists) { + $dbh->do(q{ + DELETE FROM systempreferences WHERE variable='RetainPatronSearchTerms' + }); + say $out "Wrong system preference 'RetainPatronSearchTerms' deleted"; + } else { + $dbh->do(q{ + UPDATE systempreferences SET variable='RetainPatronsSearchTerms' WHERE variable='RetainPatronSearchTerms' + }); + say $out "Wrong system preference 'RetainPatronSearchTerms' renamed 'RetainPatronsSearchTerms'"; + } + }, +}; -- 2.39.5