From e12e5aa49ebf3aaf66cd8e2a8c575c9c581c8a57 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 --- .../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 00000000000..d0315ab2db7 --- /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 95a3735906c..c61e59ba8fe 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3875,6 +3875,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)', @@ -4317,7 +4318,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.25.1