Bugzilla – Attachment 44246 Details for
Bug 14978
issues.itemnumber should be a unique key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14978: Add unique key constraint on issues.itemnumber
PASSED-QA-Bug-14978-Add-unique-key-constraint-on-i.patch (text/plain), 2.44 KB, created by
Kyle M Hall (khall)
on 2015-10-30 18:18:13 UTC
(
hide
)
Description:
[PASSED QA] Bug 14978: Add unique key constraint on issues.itemnumber
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-10-30 18:18:13 UTC
Size:
2.44 KB
patch
obsolete
>From 40940e07b8506fced1061f92a6c710d23498175c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 8 Oct 2015 09:15:57 +0100 >Subject: [PATCH] [PASSED QA] Bug 14978: Add unique key constraint on issues.itemnumber >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The constraint might have existed before bug 14069. >For these DB, this patch will restore it, for others, it will add it :) > >Test plan: >> show create table issues; >should not return "unique key itemnumber" >Execute the updatedb entry twice >> show create table issues; >should return only one "unique key itemnumber" > >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 ++++++++++ > 2 files changed, 11 insertions(+), 0 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 3a30585..12b7924 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1148,6 +1148,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues > `issuedate` datetime default NULL, -- date the item was checked out or issued > `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag > PRIMARY KEY (`issue_id`), >+ UNIQUE KEY `itemnumber` (`itemnumber`), > KEY `issuesborridx` (`borrowernumber`), > KEY `itemnumber_idx` (`itemnumber`), > KEY `branchcode_idx` (`branchcode`), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 0f03623..a26b573 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -11237,6 +11237,16 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = 'XXX'; >+if ( CheckVersion($DBversion) ) { >+ my $create_table_issues = @{ $dbh->selectall_arrayref(q|SHOW CREATE TABLE issues|) }[0]->[1]; >+ if ($create_table_issues !~ m|UNIQUE KEY.*itemnumber| ) { >+ $dbh->do(q|ALTER TABLE issues ADD CONSTRAINT UNIQUE KEY (itemnumber)|); >+ } >+ print "Update to $DBversion done (Bug 14978: Make sure issues.itemnumber is a unique key)\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. >-- >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 14978
:
43219
|
43342
| 44246