From 50bbc80f744d655ede2f8a3bffb64aff10048de6 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 --- .../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 00000000000..ea67b201ca2 --- /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 16310f0f449..c26466a7f9f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4882,7 +4882,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', `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold', `branchcode` varchar(10) DEFAULT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at', @@ -4897,7 +4897,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)', `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)', @@ -5432,7 +5432,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', `item_group_id` int(11) DEFAULT NULL COMMENT 'foreign key from the item_groups table defining if this is an item group level hold', `branchcode` varchar(10) NOT NULL COMMENT 'foreign key from the branches table defining which branch the patron wishes to pick this hold up at', @@ -5447,7 +5447,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 (calculated value)', + `expirationdate` datetime 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, -- 2.30.2