[Koha-patches] [PATCH 1/2] Bug 4331 Index aqorders by budget_id
Colin Campbell
colin.campbell at ptfs-europe.com
Tue Mar 23 10:59:20 CET 2010
Calculation of budget spent and encumbered is done by
queries on aqorders by budget_id
Index budget_id to speed these queries
---
installer/data/mysql/kohastructure.sql | 2 ++
installer/data/mysql/updatedatabase.pl | 7 +++++++
kohaversion.pl | 2 +-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 1d5cba9..ace212e 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2522,10 +2522,12 @@ CREATE TABLE `aqorders` (
PRIMARY KEY (`ordernumber`),
KEY `basketno` (`basketno`),
KEY `biblionumber` (`biblionumber`),
+ KEY `budget_id` (`budget_id`),
CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
--
-- Table structure for table `aqorders_items`
--
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index e21b37c..eb364d3 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3548,6 +3548,13 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
SetVersion ($DBversion);
}
+$DBversion = '3.01.00.128';
+if (C4::Context->preference('Version') < TransformToNum($DBversion)){
+ $dbh->do('CREATE INDEX budget_id ON aqorders (budget_id );');
+ print "Upgrade to $DBversion done (bug 4331: index orders by budget_id)\n";
+ SetVersion ($DBversion);
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
diff --git a/kohaversion.pl b/kohaversion.pl
index 50f5ef4..52efaa0 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
use strict;
sub kohaversion {
- our $VERSION = '3.01.00.127';
+ our $VERSION = '3.01.00.128';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
--
1.6.6.1
More information about the Koha-patches
mailing list