Bugzilla – Attachment 13304 Details for
Bug 9030
There is no constraint on aqorders_items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9030: Add constraint on aqorders_items.ordernumber
Bug-9030-Add-constraint-on-aqordersitemsordernumbe.patch (text/plain), 2.15 KB, created by
Jonathan Druart
on 2012-11-08 12:55:05 UTC
(
hide
)
Description:
Bug 9030: Add constraint on aqorders_items.ordernumber
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-11-08 12:55:05 UTC
Size:
2.15 KB
patch
obsolete
>From 59886d3a61eb7197613ecc2e4eef5d1991a47afa Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 8 Nov 2012 13:54:47 +0100 >Subject: [PATCH] Bug 9030: Add constraint on aqorders_items.ordernumber > >--- > installer/data/mysql/kohastructure.sql | 3 ++- > installer/data/mysql/updatedatabase.pl | 14 ++++++++++++++ > 2 files changed, 16 insertions(+), 1 deletion(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 29ee782..4c37aad 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2822,7 +2822,8 @@ CREATE TABLE `aqorders_items` ( -- information on items entered in the acquisiti > `itemnumber` int(11) NOT NULL, -- the item number for this item (items.itemnumber) > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this order item was last touched > PRIMARY KEY (`itemnumber`), >- KEY `ordernumber` (`ordernumber`) >+ KEY `ordernumber` (`ordernumber`), >+ CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 7ab48ee..ea5cf4f 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6020,6 +6020,20 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.09.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do(q{ >+ DELETE from aqorders_items where ordernumber NOT IN (SELECT ordernumber FROM aqorders); >+ }); >+ $dbh->do(q{ >+ ALTER TABLE aqorders_items >+ ADD CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) >+ ON DELETE CASCADE ON UPDATE CASCADE; >+ }); >+ print "Upgrade to $DBversion done (Bug 9030: Add constraint on aqorders_items.ordernumber)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9030
:
13304
|
13349
|
13595