Bugzilla – Attachment 62147 Details for
Bug 18427
Add a primary key to serialitems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18427: Add a primary key to serialitems
Bug-18427-Add-a-primary-key-to-serialitems.patch (text/plain), 2.38 KB, created by
Marcel de Rooy
on 2017-04-13 12:03:38 UTC
(
hide
)
Description:
Bug 18427: Add a primary key to serialitems
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-04-13 12:03:38 UTC
Size:
2.38 KB
patch
obsolete
>From cd3c97e4996d5e1174e697c5625c552d1e7f5d9d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 13 Apr 2017 13:34:36 +0200 >Subject: [PATCH] Bug 18427: Add a primary key to serialitems >Content-Type: text/plain; charset=utf-8 > >We drop the unique index serialitemsidx and add a primary key consisting >of itemnumber just as the unique key did. > >Test plan: >Run the db revision. >Apply bug 18182. The TestBuilder.t should no longer fail on serialitems. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > installer/data/mysql/atomicupdate/bug18427.perl | 17 +++++++++++++++++ > installer/data/mysql/kohastructure.sql | 2 +- > 2 files changed, 18 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug18427.perl > >diff --git a/installer/data/mysql/atomicupdate/bug18427.perl b/installer/data/mysql/atomicupdate/bug18427.perl >new file mode 100644 >index 0000000..a77a948 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug18427.perl >@@ -0,0 +1,17 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ # In order to be overcomplete, we check if the situation is what we expect >+ if( !index_exists( 'serialitems', 'PRIMARY' ) ) { >+ if( index_exists( 'serialitems', 'serialitemsidx' ) ) { >+ $dbh->do(q| >+ALTER TABLE serialitems ADD PRIMARY KEY (itemnumber), DROP INDEX serialitemsidx; >+ |); >+ } else { >+ $dbh->do(q|ALTER TABLE serialitems ADD PRIMARY KEY (itemnumber)|); >+ } >+ } >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 18427 - Add a primary key to serialitems)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 076d745..f65423c 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2436,7 +2436,7 @@ DROP TABLE IF EXISTS `serialitems`; > CREATE TABLE `serialitems` ( > `itemnumber` int(11) NOT NULL, > `serialid` int(11) NOT NULL, >- UNIQUE KEY `serialitemsidx` (`itemnumber`), >+ PRIMARY KEY (`itemnumber`), > KEY `serialitems_sfk_1` (`serialid`), > CONSTRAINT `serialitems_sfk_1` FOREIGN KEY (`serialid`) REFERENCES `serial` (`serialid`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `serialitems_sfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE >-- >2.1.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 18427
:
62144
|
62145
|
62146
|
62147
|
62365
|
62366
|
62381
|
62382