From 450e25a06dde3f78777b805efadddf01ec9dd701 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 3 Jul 2024 10:36:56 +0000 Subject: [PATCH] Bug 36453: (QA follow-up) Address upgraded instances To test: 1) Apply only this patch, skipping the next one (patch 'Use varchar instead of mediumtext') 2) Run ktd up with default DBMS mariadb:10.5: ktd up 3) Confirm the database state is wrong: DESC categories BlockExpiredPatronOpacActions; ^ This should return type = mediumtext 4) Run updatedatabase, make sure green success message shows Running the above query again will show type = varchar(128) 5) Run updatedatabase again, notice blue info message notifies its already varchar Signed-off-by: Katrin Fischer --- .../data/mysql/atomicupdate/bug_36453.pl | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_36453.pl diff --git a/installer/data/mysql/atomicupdate/bug_36453.pl b/installer/data/mysql/atomicupdate/bug_36453.pl new file mode 100755 index 0000000000..573605b9e9 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_36453.pl @@ -0,0 +1,29 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "36453", + description => "Update BlockExpiredPatronOpacActions where 240600002.pl was already run", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + my $sth = $dbh->prepare( + q{ + SELECT DATA_TYPE + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'categories' and COLUMN_NAME = 'BlockExpiredPatronOpacActions' + } + ); + $sth->execute; + my $data_type = $sth->fetchrow(); + + if( $data_type eq 'mediumtext' ) { + $dbh->do( + "ALTER TABLE categories MODIFY BlockExpiredPatronOpacActions varchar(128) NOT NULL DEFAULT 'follow_syspref_BlockExpiredPatronOpacActions' COMMENT 'specific actions expired patrons of this category are blocked from performing or if the BlockExpiredPatronOpacActions system preference is to be followed'" + ) and say_success( $out, "Updated categories.BlockExpiredPatronOpacActions to varchar(128)" ); + }else{ + say_info( $out, "categories.BlockExpiredPatronOpacActions already varchar(128)" ); + } + }, +}; -- 2.39.5