From 92ee7611a20ba36585e3389a98549d217bf0daf1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 17 May 2019 09:06:04 -0500 Subject: [PATCH] Bug 22844: Add the new DB column borrower_attribute_types.mandatory Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Katrin Fischer --- installer/data/mysql/atomicupdate/bug_22844.perl | 14 ++++++++++++++ installer/data/mysql/kohastructure.sql | 1 + 2 files changed, 15 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_22844.perl diff --git a/installer/data/mysql/atomicupdate/bug_22844.perl b/installer/data/mysql/atomicupdate/bug_22844.perl new file mode 100644 index 0000000000..def80b96d5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22844.perl @@ -0,0 +1,14 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'borrower_attribute_types', 'mandatory' ) ) { + $dbh->do(q| + ALTER TABLE borrower_attribute_types + ADD COLUMN mandatory TINYINT(1) NOT NULL DEFAULT 0 + AFTER class + |); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - Add borrower_attribute_types.mandatory)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4f6a9c399d..799adb5d81 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -228,6 +228,7 @@ CREATE TABLE `borrower_attribute_types` ( -- definitions for custom patron field `display_checkout` tinyint(1) NOT NULL default 0,-- defines if this field displays in checkout screens `category_code` VARCHAR(10) NULL DEFAULT NULL,-- defines a category for an attribute_type `class` VARCHAR(255) NOT NULL DEFAULT '',-- defines a class for an attribute_type + `mandatory` tinyint(1) NOT NULL DEFAULT 0, -- defines if the attribute is mandatory or not PRIMARY KEY (`code`), KEY `auth_val_cat_idx` (`authorised_value_category`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.11.0