From e587564844090419f9796e41d07e0ab6e975b1c5 Mon Sep 17 00:00:00 2001 From: Nicole Date: Tue, 2 Feb 2016 09:33:46 -0500 Subject: [PATCH] Bug 13795: Delete unused columns from statistics 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 b98b017..5d4f7fb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2021,25 +2021,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, -- type of procedure used when making payments (does not appear in the 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, -- used by SIP - `usercode` varchar(10) default NULL, -- unused in Koha `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, -- unused in Koha `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 a67727f..7cc7dbd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -11721,6 +11721,21 @@ if ( CheckVersion($DBversion) ) { } +$DBversion = "3.23.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); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.1.4