diff --git a/installer/data/mysql/atomicupdate/bug_29341.pl b/installer/data/mysql/atomicupdate/bug_29341.pl new file mode 100755 index 0000000000..d9abc04b9c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_29341.pl @@ -0,0 +1,17 @@ +use Modern::Perl; + +return { + bug_number => "29341", + description => "Remove foreign keys on pseudonymized_transactions", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + for my $fk ( qw( pseudonymized_transactions_borrowers_ibfk_2 pseudonymized_transactions_borrowers_ibfk_3 pseudonymized_transactions_ibfk_1 ) ) { + if ( foreign_key_exists( 'pseudonymized_transactions', $fk ) ) { + $dbh->do(qq{ + ALTER TABLE pseudonymized_transactions DROP FOREIGN KEY $fk + }); + } + } + }, +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ccf99df9e0..d5768b9e9c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4230,10 +4230,7 @@ CREATE TABLE `pseudonymized_transactions` ( PRIMARY KEY (`id`), KEY `pseudonymized_transactions_ibfk_1` (`categorycode`), KEY `pseudonymized_transactions_borrowers_ibfk_2` (`branchcode`), - KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`), - CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`), - CONSTRAINT `pseudonymized_transactions_borrowers_ibfk_3` FOREIGN KEY (`transaction_branchcode`) REFERENCES `branches` (`branchcode`), - CONSTRAINT `pseudonymized_transactions_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) + KEY `pseudonymized_transactions_borrowers_ibfk_3` (`transaction_branchcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */;