[Koha-patches] [PATCH] bug_7509: Added index on items itemcallnumber

Srdjan Jankovic srdjan at catalyst.net.nz
Wed Feb 8 03:24:29 CET 2012


---
 installer/data/mysql/kohastructure.sql |    1 +
 installer/data/mysql/updatedatabase.pl |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 37113c2..34bf1d6 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1045,6 +1045,7 @@ CREATE TABLE `items` ( -- holdings/item information
   KEY `itembibnoidx` (`biblionumber`),
   KEY `homebranch` (`homebranch`),
   KEY `holdingbranch` (`holdingbranch`),
+  KEY (itemcallnumber),
   CONSTRAINT `items_ibfk_1` FOREIGN KEY (`biblioitemnumber`) REFERENCES `biblioitems` (`biblioitemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
   CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE,
   CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 099dfb9..dc79bd9 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4663,6 +4663,14 @@ ENDOFRENEWAL
     print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
     SetVersion($DBversion);
 }
+
+$DBversion = "3.07.00.XXX";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("ALTER TABLE items ADD KEY (itemcallnumber)"
+    print "Upgrade to $DBversion done (Added index on items.itemcallnumber)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
-- 
1.6.5



More information about the Koha-patches mailing list