DBREv Bug 16354 - Fix FK constraints for edifact_messages table
authorBrendan Gallagher <brendan@bywatersolutions.com>
Tue, 26 Apr 2016 23:14:02 +0000 (23:14 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Tue, 26 Apr 2016 23:14:02 +0000 (23:14 +0000)
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Koha.pm
installer/data/mysql/atomicupdate/bug_16354.sql [deleted file]
installer/data/mysql/updatedatabase.pl

diff --git a/Koha.pm b/Koha.pm
index 884ceaf..91b16e3 100644 (file)
--- 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 (file)
index 768bd1d..0000000
+++ /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;
index 57c83db..1f1c5a0 100755 (executable)
@@ -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.