From 6428287ae9e8c9904aeaf6c747bb5879731b8494 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Thu, 17 May 2018 09:22:03 +0100 Subject: [PATCH] Bug 20772: Add 'illrequestattributes.readonly' This patch adds a 'readonly' column to illrequestattributes. On a DB upgrade it also populates all existing rows with 1, indicating 'read only' Signed-off-by: Barry Cannon Signed-off-by: Katrin Fischer --- .../bug_20772-add-readonly-flag-to-illrequestattributes.perl | 11 +++++++++++ installer/data/mysql/kohastructure.sql | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl diff --git a/installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl b/installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl new file mode 100644 index 0000000..ab64c15 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl @@ -0,0 +1,11 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'illrequestattributes', 'readonly' ) ) { + $dbh->do( "ALTER TABLE illrequestattributes ADD COLUMN readonly tinyint(1) NOT NULL DEFAULT 1" ); + $dbh->do( "UPDATE illrequestattributes SET readonly = 1" ); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 20772 - Add illrequestattributes.readonly column)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 95c3617..3be9f68 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4166,7 +4166,8 @@ DROP TABLE IF EXISTS `illrequestattributes`; CREATE TABLE illrequestattributes ( illrequest_id bigint(20) unsigned NOT NULL, -- ILL request number type varchar(200) NOT NULL, -- API ILL property name - value MEDIUMTEXT NOT NULL, -- API ILL property value + value MEDIUMTEXT NOT NULL, -- API ILL property value + readonly tinyint(1) NOT NULL DEFAULT 1, -- Is this attribute read only PRIMARY KEY (`illrequest_id`, `type` (191)), CONSTRAINT `illrequestattributes_ifk` FOREIGN KEY (illrequest_id) -- 2.1.4