From a4066ac8acd78da8f22de95db695cbda73686784 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 14 Feb 2020 08:41:28 -0500 Subject: [PATCH] Bug 23727: Add new columns --- .../data/mysql/atomicupdate/bug_23727.perl | 20 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_23727.perl diff --git a/installer/data/mysql/atomicupdate/bug_23727.perl b/installer/data/mysql/atomicupdate/bug_23727.perl new file mode 100644 index 0000000000..08f87ff307 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23727.perl @@ -0,0 +1,20 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + if ( !column_exists( 'course_items', 'itype_enabled' ) ) { + $dbh->do(q{ + ALTER TABLE course_items ADD COLUMN itype_enabled tinyint(1) NOT NULL DEFAULT 0 AFTER itype; + }); + $dbh->do(q{ + ALTER TABLE course_items ADD COLUMN ccode_enabled tinyint(1) NOT NULL DEFAULT 0 AFTER ccode; + }); + $dbh->do(q{ + ALTER TABLE course_items ADD COLUMN holdingbranch_enabled tinyint(1) NOT NULL DEFAULT 0 AFTER holdingbranch; + }); + $dbh->do(q{ + ALTER TABLE course_items ADD COLUMN location_enabled tinyint(1) NOT NULL DEFAULT 0 AFTER location; + }); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 23727 - Editing course reserve items is broken)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 0aa3a9b784..e3f5d2d0ce 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3790,9 +3790,13 @@ CREATE TABLE `course_items` ( `ci_id` int(11) NOT NULL AUTO_INCREMENT, -- course item id `itemnumber` int(11) NOT NULL, -- items.itemnumber for the item on reserve `itype` varchar(10) DEFAULT NULL, -- new itemtype for the item to have while on reserve (optional) + `itype_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve `ccode` varchar(80) DEFAULT NULL, -- new category code for the item to have while on reserve (optional) + `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if ccode should be changed while on course reserve `holdingbranch` varchar(10) DEFAULT NULL, -- new holding branch for the item to have while on reserve (optional) + `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve `location` varchar(80) DEFAULT NULL, -- new shelving location for the item to have while on reseve (optional) + `location_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve `enabled` enum('yes','no') NOT NULL DEFAULT 'no', -- if at least one enabled course has this item on reseve, this field will be 'yes', otherwise it will be 'no' `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`ci_id`), -- 2.21.1 (Apple Git-122.3)