Koha/installer/data/mysql/db_revs/220600049.pl
Tomas Cohen Arazi 4a27800c62
Bug 30490: DBRev 22.06.00.049
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-22 08:33:09 -03:00

18 lines
530 B
Perl
Executable file

use Modern::Perl;
return {
bug_number => 30490,
description => "Adjust FK constraint for parent item type",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
if( foreign_key_exists('itemtypes', 'itemtypes_ibfk_1') ) {
$dbh->do(q{
alter table itemtypes drop foreign key itemtypes_ibfk_1;
});
}
$dbh->do(q{
alter table itemtypes add foreign key itemtypes_ibfk_1 (`parent_type`) REFERENCES `itemtypes` (`itemtype`);
});
},
};