Koha/installer/data/mysql/atomicupdate/bug_35610.pl
Jonathan Druart 943838ed99
Bug 35610: Add FK on old_reserves.branchcode
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-04 15:24:25 +02:00

18 lines
635 B
Perl
Executable file

use Modern::Perl;
return {
bug_number => "35610",
description => "Add FK on old_reserves.branchcode",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
unless ( foreign_key_exists('old_reserves', 'old_reserves_ibfk_branchcode') ) {
$dbh->do(q{
ALTER TABLE old_reserves
ADD CONSTRAINT `old_reserves_ibfk_branchcode` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE;
});
say $out "Added foreign key on 'old_reserves.branchcode'"
}
},
};