Koha/installer/data/mysql/db_revs/230600014.pl
Tomas Cohen Arazi 2e40b1c356
Bug 30451: DBRev 23.06.00.014
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-08-15 11:25:41 +03: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";
},
};