From 6c3846febdb13768f596ca6dbfba054dfd3624c0 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 --- .../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 8c05d11cd9..c088e9de57 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2688,6 +2688,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)', @@ -3660,6 +3661,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.34.1