[Koha-patches] [PATCH] [HEAD](bug 4989) add index on guarantorid

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Tue Jul 13 10:56:12 CEST 2010


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

diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 7bc5e51..fc62421 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -260,6 +260,7 @@ CREATE TABLE `borrowers` (
   KEY `categorycode` (`categorycode`),
   KEY `branchcode` (`branchcode`),
   KEY `userid` (`userid`),
+  KEY `guarantorid` (`guarantorid`),
   CONSTRAINT `borrowers_ibfk_1` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`),
   CONSTRAINT `borrowers_ibfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index dd3b999..f38b2da 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4444,7 +4444,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
-
+$DBversion = "3.02.00.025";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE borrowers ADD KEY `guarantorid` (guarantorid);");
+    print "Upgrade to $DBversion done (Add index on guarantorid)\n";
+    SetVersion ($DBversion);
+}
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
-- 
1.7.0.4



More information about the Koha-patches mailing list