From e1ab68f4b75a7556aae608d5c5d0eef05864b4ed 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 Signed-off-by: Peter Moore --- .../data/mysql/atomicupdate/bug_23260.pl | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_23260.pl diff --git a/installer/data/mysql/atomicupdate/bug_23260.pl b/installer/data/mysql/atomicupdate/bug_23260.pl new file mode 100755 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