Koha/installer/data/mysql/db_revs/230502002.pl
Fridolin Somers bff8349045 Bug 30451: DBRev 23.05.02.002
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2023-08-17 08:48:01 -10:00

22 lines
766 B
Perl
Executable file

use Modern::Perl;
return {
bug_number => "30451",
description => "Update FK constraint on aqorders.subscriptionid to ON DELETE SET NULL",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
if ( foreign_key_exists( 'aqorders', 'aqorders_subscriptionid' ) ) {
$dbh->do(q{
ALTER TABLE aqorders
DROP FOREIGN KEY aqorders_subscriptionid
});
}
$dbh->do(q{
ALTER TABLE aqorders
ADD CONSTRAINT `aqorders_subscriptionid` FOREIGN KEY (`subscriptionid`) REFERENCES subscription(`subscriptionid`) ON DELETE SET NULL ON UPDATE CASCADE
});
say $out "Update FK constraint on subscriptionid";
},
};