From d768b9ecc8f8ceca969d0ae6d5d2efce526b95f5 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 18 Oct 2017 13:05:40 +0000 Subject: [PATCH] Bug 19482 - DB changes Signed-off-by: Nicolas Legrand --- .../atomicupdate/bug_19482_add_mandatory_field_to_mapping.perl | 10 ++++++++++ installer/data/mysql/kohastructure.sql | 1 + 2 files changed, 11 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_19482_add_mandatory_field_to_mapping.perl diff --git a/installer/data/mysql/atomicupdate/bug_19482_add_mandatory_field_to_mapping.perl b/installer/data/mysql/atomicupdate/bug_19482_add_mandatory_field_to_mapping.perl new file mode 100644 index 0000000..2bda6dd --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_19482_add_mandatory_field_to_mapping.perl @@ -0,0 +1,10 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'search_field', 'mandatory' ) ) { + $dbh->do( "ALTER TABLE search_field ADD COLUMN mandatory tinyint(1) NULL DEFAULT NULL" ); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 19482 - Add mandatory column to search_field for ES mapping)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8151a29..03d413f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1456,6 +1456,7 @@ CREATE TABLE `search_field` ( `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine', `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display', `type` ENUM('', 'string', 'date', 'number', 'boolean', 'sum') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine', + `mandatory` tinyint(1) NULL DEFAULT NULL COMMENT 'if marked this field is not editable or removable', PRIMARY KEY (`id`), UNIQUE KEY (`name` (191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- 2.1.4