Bug 13795: Delete unused columns from statistics table
authorNicole <nicole@bywatersolutions.com>
Tue, 2 Feb 2016 14:33:46 +0000 (09:33 -0500)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 18 Apr 2019 10:05:51 +0000 (10:05 +0000)
The following 2 fields are never used in the statistics table:

associatedborrower
usercode

This patch removes them.

To test:

* check the database and make sure columns are gone

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

installer/data/mysql/atomicupdate/Bug13795_Remove_unused_columns.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql

diff --git a/installer/data/mysql/atomicupdate/Bug13795_Remove_unused_columns.perl b/installer/data/mysql/atomicupdate/Bug13795_Remove_unused_columns.perl
new file mode 100644 (file)
index 0000000..51e223e
--- /dev/null
@@ -0,0 +1,12 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do(q{
+        ALTER TABLE statistics
+         DROP COLUMN associatedborrower
+         DROP COLUMN usercode
+    });
+
+    SetVersion($DBversion);
+
+    print "Upgrade to $DBversion done (Bug 13795 - Delete unused fields from statistics table)\n";
+}
index 8c60c99..be047ff 100644 (file)
@@ -1983,21 +1983,17 @@ CREATE TABLE `statistics` ( -- information related to transactions (circulation
   `value` double(16,4) default NULL, -- monetary value associated with the transaction
   `type` varchar(16) default NULL, -- transaction type (localuse, issue, return, renew, writeoff, payment)
   `other` LONGTEXT, -- 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
   `location` varchar(80) default NULL, -- authorized value for the shelving location for this item (MARC21 952$c)
   `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(80) default NULL, -- foreign key from the items table, links transaction to a specific collection code
   KEY `timeidx` (`datetime`),
   KEY `branch_idx` (`branch`),
   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=utf8mb4 COLLATE=utf8mb4_unicode_ci;