Bug 29341: Remove foreign keys on pseudonymized_transactions

Behave like the statistics table and don't remove the code even if the
branch or patron's category is removed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-11-17 12:25:35 +01:00
parent 90090a3601
commit ee3ffed6f5
2 changed files with 18 additions and 4 deletions

View file

@ -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
});
}
}
},
}

View file

@ -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 */;