From ea67f3e81ae02075cb10843afcf995ba0570c972 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Tue, 23 Mar 2010 09:59:20 +0000 Subject: [PATCH] Bug 4331 Index aqorders by budget_id Calculation of budget spent and encumbered is done by queries on aqorders by budget_id Index budget_id to speed these queries Signed-off-by: Galen Charlton --- installer/data/mysql/kohastructure.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 7 +++++++ kohaversion.pl | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 1d5cba9e9f..ace212e146 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 e21b37c77d..eb364d3f39 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 50f5ef4bb8..52efaa070c 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 -- 2.39.5