From ee652b07cabe58ae10fb77f69488dbd1a74bf962 Mon Sep 17 00:00:00 2001 From: Brendan Gallagher Date: Tue, 26 Apr 2016 23:14:02 +0000 Subject: [PATCH] DBREv Bug 16354 - Fix FK constraints for edifact_messages table Signed-off-by: Brendan Gallagher --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_16354.sql | 9 --------- installer/data/mysql/updatedatabase.pl | 20 +++++++++++++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_16354.sql diff --git a/Koha.pm b/Koha.pm index 884ceaf498..91b16e3b18 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "3.23.00.050"; +$VERSION = "3.23.00.051"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_16354.sql b/installer/data/mysql/atomicupdate/bug_16354.sql deleted file mode 100644 index 768bd1df62..0000000000 --- a/installer/data/mysql/atomicupdate/bug_16354.sql +++ /dev/null @@ -1,9 +0,0 @@ -ALTER TABLE edifact_messages - DROP FOREIGN KEY emfk_vendor, - DROP FOREIGN KEY emfk_edi_acct, - DROP FOREIGN KEY emfk_basketno; - -ALTER TABLE edifact_messages - ADD CONSTRAINT emfk_vendor FOREIGN KEY ( vendor_id ) REFERENCES aqbooksellers ( id ) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT emfk_edi_acct FOREIGN KEY ( edi_acct ) REFERENCES vendor_edi_accounts ( id ) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket ( basketno ) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 57c83db612..1f1c5a0d60 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -12340,8 +12340,28 @@ while ( my ( $index_name, $fields ) = each %$indexes ) { print "Upgrade to $DBversion done (Bug 12478 - Elasticsearch support for Koha)\n"; SetVersion($DBversion); + } + + +$DBversion = "3.23.00.051"; +if ( CheckVersion($DBversion) ) { +$dbh->do(q{ + ALTER TABLE edifact_messages + DROP FOREIGN KEY emfk_vendor, + DROP FOREIGN KEY emfk_edi_acct, + DROP FOREIGN KEY emfk_basketno; + + ALTER TABLE edifact_messages + ADD CONSTRAINT emfk_vendor FOREIGN KEY ( vendor_id ) REFERENCES aqbooksellers ( id ) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT emfk_edi_acct FOREIGN KEY ( edi_acct ) REFERENCES vendor_edi_accounts ( id ) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT emfk_basketno FOREIGN KEY ( basketno ) REFERENCES aqbasket ( basketno ) ON DELETE CASCADE ON UPDATE CASCADE; + }); + +print "Upgrade to $DBversion done (Bug 16354 - Fix FK constraints for edifact_messages table)\n"; + SetVersion($DBversion); } + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5