DBREv Bug 16354 - Fix FK constraints for edifact_messages table

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
Brendan Gallagher 2016-04-26 23:14:02 +00:00
parent 9b866b91af
commit ee652b07ca
3 changed files with 21 additions and 10 deletions

View File

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

View File

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

View File

@ -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.