I ran the following on a system that has been using Koha for 3 years and it appears that none of these fields are ever used: mysql> select distinct proccode from statistics; +----------+ | proccode | +----------+ | NULL | +----------+ 1 row in set (0.00 sec) mysql> select distinct other from statistics; +-------+ | other | +-------+ | | +-------+ 1 row in set (18.30 sec) mysql> select distinct usercode from statistics; +----------+ | usercode | +----------+ | NULL | +----------+ 1 row in set (0.03 sec) mysql> select distinct associatedborrower from statistics; +--------------------+ | associatedborrower | +--------------------+ | NULL | +--------------------+ 1 row in set (0.00 sec)
Created attachment 36578 [details] [review] 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
I have something in proccode, but nothing in others: mysql> select distinct proccode from statistics; +----------+ | proccode | +----------+ | NULL | | | | 1 | | 2 | | 3 | | 6 | +----------+ 6 rows in set (0.00 sec)
All this columns are used by module Koha/Schema/Result/Statistic.pm Inside the file it read # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE and # Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:THELVmdFFi1RCI4DfqwGIw
Hi Hector, those files are generated from the database - so all the columns will appear there, but it doesn't indicate that they are used.
Patch does not apply. Besides, there are other places that reference some of this values e.g. proccode koha-tmpl/intranet-tmpl/prog/en/columns.def:<field name="statistics.proccode">Type of procedure</field> t/db_dependent/Stats.t:is ($params-> {accountno}, $line->{proccode}, "UpdateStats save accountno param in proccode field of statistics table");
Created attachment 47555 [details] [review] 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
I made it apply, but Bernardo Gonzalez Kriegel raises a valid problem in comment #5. $ git grep associatedborrower -- There is mention of it in installer/data/mysql/backfill_statistics.pl Is this script used at all? Obviously people aren't going to need it after upgrading from 2.x to 3.x versions. Perhaps safe to remove? Perhaps backfill_statistics.pl needs a rewrite? other is used in C4::Circulation::AddIssue related to SIP mode. In C4/Accounts.pm and C4/Circulation.pm (only places to use UpdateStats), the following fields are used: branch type amount other itemnumber itemtype borrowernumber ccode accountno schema says that usercode and associatedborrower is unused. Looking at C4/Stats.pm it becomes painfully clear (painful, because they shouldn't have renamed the field like that) that accountno is proccode. I wonder if people are expecting it to be longer than varchar(4). I would resubmit this modified with: 1) Just usercode and associatedborrower removed 2) an atomic update instead of a updatedatabase.pl (https://wiki.koha-community.org/wiki/Database_updates)
Could we use "usercode" to log the user/librarian who did the action? It would be useful especially for action types that are not logged in action_logs (i.e. issue renewals, payments, writeoffs) I just want to mention that I have a bunch of different values in proccode, but I have no idea what they mean. mysql> select distinct(proccode) from statistics; +----------+ | proccode | +----------+ | | | 10 | | 1005 | | 1064 | | 1073 | | 1093 | | 11 | | 1152 | | 12 | ... | 9 | | 903 | | 918 | | 920 | | 932 | | 947 | | 98 | | 991 | | 996 | +----------+ 220 rows in set (0,07 sec)
Created attachment 86809 [details] [review] Bug 13795: Delete unused columns from statistics table 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
Created attachment 86810 [details] [review] Bug 13795: Make database update idempotent
Created attachment 86811 [details] [review] Bug 13795: Remove occurences of unused columns in code These patch removes these two columns from backfill_statstics script and from columns.def - this file is used to create description in guided reports Test plan: 1. Run installer/data/mysql/backfull_statistics.pl --> without this patch, there are associatedborrower and usercode errors reported --> with patch, these two columns are not reported
Created attachment 88233 [details] [review] Bug 13795: Delete unused columns from statistics table 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>
Created attachment 88234 [details] [review] Bug 13795: Make database update idempotent Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Michal Denar <black23@gmail.com>
Created attachment 88235 [details] [review] Bug 13795: Remove occurences of unused columns in code These patch removes these two columns from backfill_statstics script and from columns.def - this file is used to create description in guided reports Test plan: 1. Run installer/data/mysql/backfull_statistics.pl --> without this patch, there are associatedborrower and usercode errors reported --> with patch, these two columns are not reported Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Michal Denar <black23@gmail.com>
Created attachment 88238 [details] [review] Bug 13795: Delete unused columns from statistics table 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>
Created attachment 88239 [details] [review] Bug 13795: Make database update idempotent 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>
Created attachment 88240 [details] [review] Bug 13795: Remove occurences of unused columns in code These patch removes these two columns from backfill_statstics script and from columns.def - this file is used to create description in guided reports Test plan: 1. Run installer/data/mysql/backfull_statistics.pl --> without this patch, there are associatedborrower and usercode errors reported --> with patch, these two columns are not reported 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>
Awesome work all! Pushed to master for 19.05
Better safe than sorry I'm not going to backport this cleanup bug just in case anyone is using these fields locally.