From 96bfea33df4f880150410b2b2d3fad527afe8bef Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 20 Oct 2021 10:57:39 +1300 Subject: [PATCH] Bug 24718: Modify reserves.reservedate and expirationdate to use datetime --- .../atomicupdate/bug_24718_-_use_datetime_for_reserves.perl | 13 +++++++++++++ installer/data/mysql/kohastructure.sql | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_24718_-_use_datetime_for_reserves.perl diff --git a/installer/data/mysql/atomicupdate/bug_24718_-_use_datetime_for_reserves.perl b/installer/data/mysql/atomicupdate/bug_24718_-_use_datetime_for_reserves.perl new file mode 100644 index 0000000000..ea67b201ca --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_24718_-_use_datetime_for_reserves.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + if( column_exists( 'reserves', 'reservedate' ) ) { + $dbh->do(q{ALTER TABLE reserves MODIFY column reservedate datetime}); + } + + if( column_exists( 'reserves', 'expirationdate' ) ) { + $dbh->do(q{ALTER TABLE reserves MODIFY column expirationdate datetime}); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 24718 - Use datetime for reserves.reservedate and reserves.expirationdate)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 48e5370448..0112644cdb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3861,7 +3861,7 @@ DROP TABLE IF EXISTS `old_reserves`; CREATE TABLE `old_reserves` ( `reserve_id` int(11) NOT NULL COMMENT 'primary key', `borrowernumber` int(11) DEFAULT NULL COMMENT 'foreign key from the borrowers table defining which patron this hold is for', - `reservedate` date DEFAULT NULL COMMENT 'the date the hold was places', + `reservedate` datetime DEFAULT NULL COMMENT 'the date the hold was places', `biblionumber` int(11) DEFAULT NULL COMMENT 'foreign key from the biblio table defining which bib record this hold is on', `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at', `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at', @@ -3875,7 +3875,7 @@ CREATE TABLE `old_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` datetime 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)', @@ -4304,7 +4304,7 @@ DROP TABLE IF EXISTS `reserves`; CREATE TABLE `reserves` ( `reserve_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `borrowernumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the borrowers table defining which patron this hold is for', - `reservedate` date DEFAULT NULL COMMENT 'the date the hold was placed', + `reservedate` datetime DEFAULT NULL COMMENT 'the date the hold was placed', `biblionumber` int(11) NOT NULL DEFAULT 0 COMMENT 'foreign key from the biblio table defining which bib record this hold is on', `branchcode` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at', `desk_id` int(11) DEFAULT NULL COMMENT 'foreign key from the desks table defining which desk the patron should pick this hold up at', @@ -4318,7 +4318,7 @@ 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` datetime 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.11.0