From 0576a227caf8d26e5e64db04357904cd63e17ef3 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 17 Jul 2018 15:47:57 +0200 Subject: [PATCH] Bug 21066: Database revision Change timestamp to publicationdate, add updated_on as 'real' timestamp. Test plan: Run install or upgrade. Check table opac_news. Signed-off-by: Marcel de Rooy Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer --- installer/data/mysql/atomicupdate/bug_21066.perl | 9 +++++++++ installer/data/mysql/kohastructure.sql | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_21066.perl diff --git a/installer/data/mysql/atomicupdate/bug_21066.perl b/installer/data/mysql/atomicupdate/bug_21066.perl new file mode 100644 index 0000000000..3a9780f78d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_21066.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q| + ALTER TABLE opac_news + CHANGE COLUMN timestamp publicationdate date DEFAULT NULL, + ADD COLUMN updated_on timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + |); + NewVersion( $DBversion, 21066, "Update table opac_news"); +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 9700ee04ab..eef121d97d 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1723,7 +1723,8 @@ CREATE TABLE `opac_news` ( -- data from the news tool `title` varchar(250) NOT NULL default '', -- title of the news article `content` MEDIUMTEXT NOT NULL, -- the body of your news article `lang` varchar(50) NOT NULL default '', -- location for the article (koha is the staff client, slip is the circulation receipt and language codes are for the opac) - `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- pulibcation date and time + `publicationdate` date DEFAULT NULL, -- publication date + `updated_on` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification `expirationdate` date default NULL, -- date the article is set to expire or no longer be visible `number` int(11) default NULL, -- the order in which this article appears in that specific location `borrowernumber` int(11) default NULL, -- The user who created the news article -- 2.11.0