Bug 20772: Add 'illrequestattributes.readonly'
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Thu, 17 May 2018 08:22:03 +0000 (09:22 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Sat, 13 Oct 2018 11:34:32 +0000 (08:34 -0300)
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 <bc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
installer/data/mysql/atomicupdate/bug_20772-add-readonly-flag-to-illrequestattributes.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql

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 (file)
index 0000000..ab64c15
--- /dev/null
@@ -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";
+}
index f086cbe..d01b2cb 100644 (file)
@@ -4176,7 +4176,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)