From 4b047cb2ecb506abe3b27905512dc1acb6d18202 Mon Sep 17 00:00:00 2001 From: Ere Maijala Date: Thu, 14 Mar 2019 14:33:18 +0200 Subject: [PATCH] Bug 19670: Change Collation of marc_field to allow mixed case mappings Test plan: 1. Apply patch and update database 2. Verify that you can add a search field mapping for both 100a and 100A. 3. Verify that the above also works with a newly-created database. Signed-off-by: Michal Denar Signed-off-by: Katrin Fischer --- installer/data/mysql/atomicupdate/bug_19670.perl | 13 +++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_19670.perl diff --git a/installer/data/mysql/atomicupdate/bug_19670.perl b/installer/data/mysql/atomicupdate/bug_19670.perl new file mode 100644 index 0000000000..fbe9e911aa --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_19670.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + my $table_sth = $dbh->prepare('SHOW CREATE TABLE `search_marc_map`'); + $table_sth->execute(); + my @table = $table_sth->fetchrow_array(); + unless ( $table[1] =~ /`marc_field`.*COLLATE utf8mb4_bin/ ) { #catches utf8mb4 collated tables + $dbh->do("ALTER TABLE `search_marc_map` MODIFY `marc_field` VARCHAR(255) NOT NULL COLLATE utf8mb4_bin COMMENT 'the MARC specifier for this field'"); + } + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 19670 - Change collation of marc_field to allow mixed case search field mappings)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 6d7a4d28e1..177360d2cb 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1491,7 +1491,7 @@ CREATE TABLE `search_marc_map` ( id int(11) NOT NULL AUTO_INCREMENT, index_name ENUM('biblios','authorities') NOT NULL COMMENT 'what storage index this map is for', marc_type ENUM('marc21', 'unimarc', 'normarc') NOT NULL COMMENT 'what MARC type this map is for', - marc_field VARCHAR(255) NOT NULL COMMENT 'the MARC specifier for this field', + marc_field VARCHAR(255) NOT NULL COLLATE utf8mb4_bin COMMENT 'the MARC specifier for this field', PRIMARY KEY(`id`), UNIQUE key `index_name` (`index_name`, `marc_field` (191), `marc_type`), INDEX (`index_name`) -- 2.11.0