From b1d9a8ae6539e6fb0d11b0c0a52af392b2e7c4f6 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 7 Apr 2023 16:30:36 +0000 Subject: [PATCH] Bug 16122: Add localuse column to items and deleteditems Signed-off-by: Christopher Brannon Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer --- .../atomicupdate/bug_16122_atomicupdate.pl | 27 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 29 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl diff --git a/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl b/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl new file mode 100755 index 0000000000..b423ae618d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl @@ -0,0 +1,27 @@ +use Modern::Perl; +return { + bug_number => "16122", + description => "Add localuser column to items table", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + if( !column_exists( 'items', 'localuse' ) ) { + $dbh->do(q{ + ALTER TABLE items + ADD COLUMN localuse smallint(6) NULL DEFAULT NULL + COMMENT "item's local use count" + AFTER renewals + }); + say $out "Added column 'items.localuse'"; + } + if( !column_exists( 'deleteditems', 'localuse' ) ) { + $dbh->do(q{ + ALTER TABLE deleteditems + ADD COLUMN localuse smallint(6) NULL DEFAULT NULL + COMMENT "deleteditems local use count" + AFTER renewals + }); + say $out "Added column 'deleteditems.localuse'"; + } + }, +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 16310f0f44..0906c5be16 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2759,6 +2759,7 @@ CREATE TABLE `deleteditems` ( `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)', `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out', `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed', + `localuse` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been recorded as localuse', `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved', `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)', `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)', @@ -4016,6 +4017,7 @@ CREATE TABLE `items` ( `coded_location_qualifier` varchar(10) DEFAULT NULL COMMENT 'coded location qualifier(MARC21 952$f)', `issues` smallint(6) DEFAULT 0 COMMENT 'number of times this item has been checked out/issued', `renewals` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been renewed', + `localuse` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been recorded as localuse', `reserves` smallint(6) DEFAULT NULL COMMENT 'number of times this item has been placed on hold/reserved', `restricted` tinyint(1) DEFAULT NULL COMMENT 'authorized value defining use restrictions for this item (MARC21 952$5)', `itemnotes` longtext DEFAULT NULL COMMENT 'public notes on this item (MARC21 952$z)', -- 2.30.2