From ba5f0d39bddc9be0a84af31c3e628f75b6736860 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 13 Oct 2021 11:02:24 +0200 Subject: [PATCH] Bug 21729: DB changes Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Florian Bontemps Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- .../data/mysql/atomicupdate/bug_21729.pl | 25 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 ++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_21729.pl diff --git a/installer/data/mysql/atomicupdate/bug_21729.pl b/installer/data/mysql/atomicupdate/bug_21729.pl new file mode 100755 index 0000000000..d0315ab2db --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_21729.pl @@ -0,0 +1,25 @@ +use Modern::Perl; + +return { + bug_number => "21729", + description => "Add new column reserves.patron_expiration_date", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + unless( column_exists('reserves', 'patron_expiration_date') ) { + $dbh->do(q{ + ALTER TABLE reserves + ADD COlUMN patron_expiration_date date DEFAULT NULL COMMENT 'the date the hold expires - usually the date entered by the patron to say they don''t need the hold after a certain date' + AFTER expirationdate + }); + } + unless( column_exists('old_reserves', 'patron_expiration_date') ) { + $dbh->do(q{ + ALTER TABLE old_reserves + ADD COlUMN patron_expiration_date date DEFAULT NULL COMMENT 'the date the hold expires - usually the date entered by the patron to say they don''t need the hold after a certain date' + AFTER expirationdate + }); + } + + }, +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index ccafdbafca..54d175fba4 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3928,6 +3928,7 @@ CREATE TABLE `old_reserves` ( `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with', `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library', `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (usually the date entered by the patron to say they don''t need the hold after a certain date)', + `patron_expiration_date` date DEFAULT NULL COMMENT 'the date the hold expires - usually the date entered by the patron to say they don''t need the hold after a certain date', `lowestPriority` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)', `suspend` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'in this hold suspended (1 for yes, 0 for no)', `suspend_until` datetime DEFAULT NULL COMMENT 'the date this hold is suspended until (NULL for infinitely)', @@ -4337,7 +4338,8 @@ CREATE TABLE `reserves` ( `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'the date and time this hold was last updated', `itemnumber` int(11) DEFAULT NULL COMMENT 'foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with', `waitingdate` date DEFAULT NULL COMMENT 'the date the item was marked as waiting for the patron at the library', - `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (usually the date entered by the patron to say they don''t need the hold after a certain date)', + `expirationdate` date DEFAULT NULL COMMENT 'the date the hold expires (calculated value)', + `patron_expiration_date` date DEFAULT NULL COMMENT 'the date the hold expires - usually the date entered by the patron to say they don''t need the hold after a certain date', `lowestPriority` tinyint(1) NOT NULL DEFAULT 0, `suspend` tinyint(1) NOT NULL DEFAULT 0, `suspend_until` datetime DEFAULT NULL, -- 2.39.5