From e836cc4e350f32c7364dea4eaecbe04046bac3d9 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 20 Feb 2025 11:50:03 +0000 Subject: [PATCH] Bug 32630: atomicupdate Sponsored-by: UKHSA - UK Health Security Agency Signed-off-by: Jeremy Evans Signed-off-by: Lisette Scheer --- .../data/mysql/atomicupdate/bug_32630.pl | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_32630.pl diff --git a/installer/data/mysql/atomicupdate/bug_32630.pl b/installer/data/mysql/atomicupdate/bug_32630.pl new file mode 100755 index 00000000000..2f543cfb5a2 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_32630.pl @@ -0,0 +1,24 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "32630", + description => "Don't delete illrequests when borrower is deleted", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{ ALTER TABLE illrequests DROP FOREIGN KEY illrequests_bnfk }); + $dbh->do( + q{ + ALTER TABLE illrequests ADD CONSTRAINT illrequests_bnfk + FOREIGN KEY(`borrowernumber`) + REFERENCES `borrowers` (`borrowernumber`) + ON DELETE SET NULL ON UPDATE CASCADE; + } + ); + + # Other information + say_success( $out, "Updated borrowernumber constraint" ); + }, +}; -- 2.39.5