From e66770b2ea9267afd78608573566a023652b4265 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 28 Oct 2022 13:56:10 +0000 Subject: [PATCH] Bug 31948: Add timestamp to tmp_holdsqueue table With the option to have real time updates to tmp_holdsqueue a timestamp will be really helpful to help find the most recently added entries. To test: * Place some holds on a record with available items * Run build_holds-queue.pl * Verify the hold shows up under circulation > holds queue * Apply patch * Run build_holds_queue.pl again * Verify this works without any issues * Turn on RealTimeHoldsQueue * Update pick-up location, add another hold * Make sure these changes are reflected in the holds queue as well * Look at the database and verify timestamps are set Signed-off-by: Kyle M Hall --- .../mysql/atomicupdate/bug_31948_tmp_holdsqueue.pl | 13 +++++++++++++ installer/data/mysql/kohastructure.sql | 1 + 2 files changed, 14 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_31948_tmp_holdsqueue.pl diff --git a/installer/data/mysql/atomicupdate/bug_31948_tmp_holdsqueue.pl b/installer/data/mysql/atomicupdate/bug_31948_tmp_holdsqueue.pl new file mode 100755 index 0000000000..c5fbd8d546 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_31948_tmp_holdsqueue.pl @@ -0,0 +1,13 @@ +use Modern::Perl; + +return { + bug_number => "31948", + description => "Add timestamp to tmp_holdsqueue table", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ALTER TABLE `tmp_holdsqueue` ADD `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP AFTER item_level_request}); + say $out ""; + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 58f8102461..e88c75f5d4 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -5382,6 +5382,7 @@ CREATE TABLE `tmp_holdsqueue` ( `pickbranch` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, `item_level_request` tinyint(4) NOT NULL DEFAULT 0, + `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'date and time this entry as added/last updated', KEY `tmp_holdsqueue_ibfk_1` (`itemnumber`), KEY `tmp_holdsqueue_ibfk_2` (`biblionumber`), KEY `tmp_holdsqueue_ibfk_3` (`borrowernumber`), -- 2.30.2