From a96bdff9cf6a9f15b65bc722f53725c2c5ee86b2 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Mon, 21 Oct 2019 17:29:44 -0300 Subject: [PATCH] Bug 23673: change db structure Signed-off-by: Kelly McElligott --- installer/data/mysql/atomicupdate/bug-23673.perl | 12 ++++++++++++ installer/data/mysql/kohastructure.sql | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug-23673.perl diff --git a/installer/data/mysql/atomicupdate/bug-23673.perl b/installer/data/mysql/atomicupdate/bug-23673.perl new file mode 100644 index 0000000000..64c52ef5d9 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-23673.perl @@ -0,0 +1,12 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + $dbh->do("ALTER TABLE message_queue MODIFY time_queued timestamp NULL"); + + if( !column_exists( 'message_queue', 'updated_on' ) ) { + $dbh->do("ALTER TABLE message_queue ADD COLUMN updated_on timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER time_queued"); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 23673 - modify time_queued and add updated_on to message_queue)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 270780ac1f..f1c193c643 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2431,7 +2431,8 @@ CREATE TABLE `message_queue` ( `letter_code` varchar(64) DEFAULT NULL, `message_transport_type` varchar(20) NOT NULL, `status` enum('sent','pending','failed','deleted') NOT NULL default 'pending', - `time_queued` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `time_queued` timestamp NULL, + `updated_on` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `to_address` LONGTEXT, `from_address` LONGTEXT, `content_type` MEDIUMTEXT, -- 2.17.1