Koha/installer/data/mysql/db_revs/220600084.pl
Jonathan Druart bc8a9b36ab
Bug 35698: (bug 32162 follow-up) fix bug number in db rev
Should be 32162, not 31162.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-01-04 16:51:44 +01:00

24 lines
1.1 KiB
Perl
Executable file

use Modern::Perl;
return {
bug_number => "32162",
description => "Add primary key to erm_eholdings_packages_agreements",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
unless ( primary_key_exists('erm_eholdings_packages_agreements') ){
$dbh->do(q{
ALTER TABLE erm_eholdings_packages_agreements
DROP FOREIGN KEY erm_eholdings_packages_agreements_ibfk_1,
DROP FOREIGN KEY erm_eholdings_packages_agreements_ibfk_2,
DROP CONSTRAINT erm_eholdings_packages_agreements_uniq,
ADD PRIMARY KEY(`package_id`, `agreement_id`)
});
$dbh->do(q{
ALTER TABLE erm_eholdings_packages_agreements
ADD CONSTRAINT `erm_eholdings_packages_agreements_ibfk_1` FOREIGN KEY (`package_id`) REFERENCES `erm_eholdings_packages` (`package_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `erm_eholdings_packages_agreements_ibfk_2` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE
});
}
},
};