From f409c6b26811186ab0f9b93724cbcc2125b761b8 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 13 Jan 2020 11:41:21 -0300 Subject: [PATCH] Bug 22987: Add biblioimages.timestamp This patch adds the timestamp column to the biblioimages table. To test: 1. Apply this patch 2. Run: $ updatedatabase $ koha-mysql kohadev > SHOW CREATE TABLE biblioimages; => SUCCESS: Notice the new column is there with the right settings 3. Sign off :-D Signed-off-by: Owen Leonard --- installer/data/mysql/atomicupdate/bug_22987.perl | 11 +++++++++++ installer/data/mysql/kohastructure.sql | 1 + 2 files changed, 12 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_22987.perl diff --git a/installer/data/mysql/atomicupdate/bug_22987.perl b/installer/data/mysql/atomicupdate/bug_22987.perl new file mode 100644 index 00000000000..85ec28c5112 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22987.perl @@ -0,0 +1,11 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + ALTER TABLE biblioimages + ADD `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + AFTER `thumbnail`; + }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 22987 - Add biblioimages.timestamp)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 0f092725b5a..5565e57de8e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3275,6 +3275,7 @@ CREATE TABLE `biblioimages` ( -- local cover images `mimetype` varchar(15) NOT NULL, -- image type `imagefile` mediumblob NOT NULL, -- image file contents `thumbnail` mediumblob NOT NULL, -- thumbnail file contents + `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- image creation/update time PRIMARY KEY (`imagenumber`), CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.11.0