@@ -, +, @@ --- installer/data/mysql/atomicupdate/bug_30490.pl | 18 ++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_30490.pl --- a/installer/data/mysql/atomicupdate/bug_30490.pl +++ a/installer/data/mysql/atomicupdate/bug_30490.pl @@ -0,0 +1,18 @@ +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`); + }); + }, +}; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -3344,7 +3344,7 @@ CREATE TABLE `itemtypes` ( PRIMARY KEY (`itemtype`), UNIQUE KEY `itemtype` (`itemtype`), KEY `itemtypes_ibfk_1` (`parent_type`), - CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `itemtypes_ibfk_1` FOREIGN KEY (`parent_type`) REFERENCES `itemtypes` (`itemtype`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --