Bugzilla – Attachment 34159 Details for
Bug 12555
The DelItem subroutine should be called on canceling a receipt
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12555: Add a FK on aqorders_items.itemnumber
PASSED-QA-Bug-12555-Add-a-FK-on-aqordersitemsitemn.patch (text/plain), 2.70 KB, created by
Kyle M Hall (khall)
on 2014-12-05 15:55:10 UTC
(
hide
)
Description:
[PASSED QA] Bug 12555: Add a FK on aqorders_items.itemnumber
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-12-05 15:55:10 UTC
Size:
2.70 KB
patch
obsolete
>From ac9a95228888c84726b703d1ed2e30e69f9ae115 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 20 Aug 2014 12:02:56 +0200 >Subject: [PATCH] [PASSED QA] Bug 12555: Add a FK on aqorders_items.itemnumber > >The previous patch assumed that deleting an item will delete the entry >in aqorders_items. But the FK did not exist. > >Looking at the code, we never join aqorders_items and deleteditems, so I >think we can add this constraint. > >Before adding this constraint, we need to delete all entries in >aqorders_items if the item has already been deleted. > >Signed-off-by: Paola Rossi <paola.rossi@cineca.it> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/kohastructure.sql | 3 ++- > installer/data/mysql/updatedatabase.pl | 15 +++++++++++++++ > 2 files changed, 17 insertions(+), 1 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 4ffbbf2..ceb378d 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3098,7 +3098,8 @@ CREATE TABLE `aqorders_items` ( -- information on items entered in the acquisiti > `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`), >- CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE >+ CONSTRAINT aqorders_items_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT `aqorders_items_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) 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 cf17e0b..16ce855 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9585,6 +9585,21 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = '3.17.00.XXX'; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q| >+ DELETE aqorders_items.* >+ FROM aqorders_items >+ LEFT JOIN items ON items.itemnumber=aqorders_items.itemnumber >+ WHERE items.itemnumber IS NULL >+ |); >+ $dbh->do(q| >+ ALTER TABLE aqorders_items ADD FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE >+ |); >+ print "Upgrade to $DBversion done (Bug 12555 - Add a foreign key on aqorders_items.itemnumber)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >1.7.2.5
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 12555
:
29752
|
30613
|
31008
|
33290
|
33291
|
34016
|
34017
|
34157
|
34158
| 34159