From 4f4d30975aa617e128a50af688b3b867c83528af 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 Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- 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 0000000000..85ec28c511 --- /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 dd2a4dd0ad..d806845340 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3276,6 +3276,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.20.1