From 0137e49d6fa77bc57e8db16ad0314b6207cd89ac Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Dec 2016 15:20:24 +0100 Subject: [PATCH] Bug 17762: Remove FK on message_transports I don't really understand where does come from this foreign key but at first glance it does not make sense. Note that it seems we could also remove message_transports.branchcode Sponsored-by: Orex Digital Signed-off-by: Hugo Agud Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- installer/data/mysql/atomicupdate/bug_xxxxx.perl | 3 +++ installer/data/mysql/kohastructure.sql | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_xxxxx.perl b/installer/data/mysql/atomicupdate/bug_xxxxx.perl index 22583e98d3..43d3c269ed 100644 --- a/installer/data/mysql/atomicupdate/bug_xxxxx.perl +++ b/installer/data/mysql/atomicupdate/bug_xxxxx.perl @@ -10,6 +10,9 @@ if( CheckVersion( $DBversion ) ) { $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN lang VARCHAR(25) NOT NULL DEFAULT 'default' AFTER lastseen" ); } + # Add test on existene of this key + ALTER TABLE message_transports DROP FOREIGN KEY message_transports_ibfk_3; + $dbh->do( "INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('TranslateNotices', '0', NULL, 'Allow notices to be translated', 'YesNo') "); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 2cd90e5d74..6397e64bd5 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2595,8 +2595,7 @@ CREATE TABLE `message_transports` ( KEY `message_transport_type` (`message_transport_type`), KEY `letter_module` (`letter_module`,`letter_code`), CONSTRAINT `message_transports_ibfk_1` FOREIGN KEY (`message_attribute_id`) REFERENCES `message_attributes` (`message_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `message_transports_ibfk_3` FOREIGN KEY (`letter_module`, `letter_code`, `branchcode`) REFERENCES `letter` (`module`, `code`, `branchcode`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `message_transports_ibfk_2` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- 2.11.0