From 844611037e5c16ea68bdd0eea5dc78c50b1e37b1 Mon Sep 17 00:00:00 2001 From: Nicole Date: Thu, 5 Mar 2015 05:04:34 -0800 Subject: [PATCH] Bug 13795: Delete unused columns from stats table The following 4 fields are never used in the statistics table: associatedborrower other proccode usercode This patch removes them. To test: * check the database and make sure columns are gone --- installer/data/mysql/kohastructure.sql | 7 ------- installer/data/mysql/updatedatabase.pl | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 08ef9ee..2d7bdc1 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2007,25 +2007,18 @@ DROP TABLE IF EXISTS `statistics`; CREATE TABLE `statistics` ( -- information related to transactions (circulation and fines) in Koha `datetime` datetime default NULL, -- date and time of the transaction `branch` varchar(10) default NULL, -- foreign key, branch where the transaction occurred - `proccode` varchar(4) default NULL, -- proceedure code `value` double(16,4) default NULL, -- monetary value associated with the transaction `type` varchar(16) default NULL, -- transaction type (locause, issue, return, renew, writeoff, payment, Credit*) - `other` mediumtext, - `usercode` varchar(10) default NULL, `itemnumber` int(11) default NULL, -- foreign key from the items table, links transaction to a specific item `itemtype` varchar(10) default NULL, -- foreign key from the itemtypes table, links transaction to a specific item type `borrowernumber` int(11) default NULL, -- foreign key from the borrowers table, links transaction to a specific borrower - `associatedborrower` int(11) default NULL, `ccode` varchar(10) default NULL, -- foreign key from the items table, links transaction to a specific collection code KEY `timeidx` (`datetime`), KEY `branch_idx` (`branch`), - KEY `proccode_idx` (`proccode`), KEY `type_idx` (`type`), - KEY `usercode_idx` (`usercode`), KEY `itemnumber_idx` (`itemnumber`), KEY `itemtype_idx` (`itemtype`), KEY `borrowernumber_idx` (`borrowernumber`), - KEY `associatedborrower_idx` (`associatedborrower`), KEY `ccode_idx` (`ccode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0ed56c6..be6e29f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9793,6 +9793,21 @@ if(CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.19.00.XXX"; +if(CheckVersion($DBversion)) { + $dbh->do(q{ + ALTER TABLE statistics + DROP COLUMN associatedborrower + DROP COLUMN usercode + DROP COLUMN other + DROP COLUMN proccode + }); + + + print "Upgrade to $DBversion done (Bug 13795 - Delete unused fields from statistics table)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 1.7.10.4