From 0bbf9c532f48b9218169088615ad5528ac2e0873 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 3 Jun 2025 16:13:26 +0000 Subject: [PATCH] Bug 23260: Fix DB update --- .../data/mysql/atomicupdate/bug_23260.perl | 22 ---------------- .../data/mysql/atomicupdate/bug_23260.pl | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+), 22 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_23260.perl create mode 100644 installer/data/mysql/atomicupdate/bug_23260.pl diff --git a/installer/data/mysql/atomicupdate/bug_23260.perl b/installer/data/mysql/atomicupdate/bug_23260.perl deleted file mode 100644 index 57199bf281b..00000000000 --- a/installer/data/mysql/atomicupdate/bug_23260.perl +++ /dev/null @@ -1,22 +0,0 @@ -use Modern::Perl; - -return { - bug_number => "23260", - description => "Make borrowernumber from items_last_borrower nullable, and add AnonymizeLastBorrower and AnonymizeLastBorrowerDays preferences", - up => sub { - my ($args) = @_; - my ( $dbh, $out ) = @$args{qw(dbh out)}; - - # Do you stuffs here - $dbh->do(q{}); - $dbh->do( "ALTER TABLE items_last_borrower MODIFY COLUMN `borrowernumber` int(11) default NULL" ); - say $out "items_last_borrower updated to allow NULL borrowernumbers"; - - $dbh->do(q{ - INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES - ('AnonymizeLastBorrower','0',NULL,'If enabled, anonymize item\'s last borrower','YesNo'), - ('AnonymizeLastBorrowerDays','0',NULL,'Item\'s last borrower older than this preference will be anonymized','Integer') - }); - say $out "Added new system preferences 'AnonymizeLastBorrower' and 'AnonymizeLastBorrowerDays'"; - }, -}; diff --git a/installer/data/mysql/atomicupdate/bug_23260.pl b/installer/data/mysql/atomicupdate/bug_23260.pl new file mode 100644 index 00000000000..db25c498192 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23260.pl @@ -0,0 +1,25 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "23260", + description => + "Make borrowernumber from items_last_borrower nullable, and add AnonymizeLastBorrower and AnonymizeLastBorrowerDays preferences", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Do you stuffs here + $dbh->do("ALTER TABLE items_last_borrower MODIFY COLUMN `borrowernumber` int(11) NULL"); + say_success( $out, "items_last_borrower updated to allow NULL borrowernumbers" ); + + $dbh->do( + q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('AnonymizeLastBorrower','0',NULL,'If enabled, anonymize item\'s last borrower','YesNo'), + ('AnonymizeLastBorrowerDays','0',NULL,'Item\'s last borrower older than this preference will be anonymized','Integer') + } + ); + say_success( $out, "Added new system preferences 'AnonymizeLastBorrower' and 'AnonymizeLastBorrowerDays'" ); + }, +}; -- 2.39.5