From 70d916b8e41aa824da0877f90430c0ba8f513b33 Mon Sep 17 00:00:00 2001 From: Nicolas Legrand Date: Mon, 9 Mar 2015 17:07:31 +0100 Subject: [PATCH] Change default collation to utf8_bin When upgrading database from 3.18 to master upgrade Upgrade to 3.19.00.006 (Bug 11944 - Convert DB tables to utf8_unicode_ci) may fail like this: DBD::mysql::db do failed: Duplicate entry 'ACQ-995-a' for key 'PRIMARY' at ./installer/data/mysql/updatedatabase.pl line 9671. This is from table marc_subfield_structure where the keys are made of framework (ACQ), tagfield (995) and tagsubfield (a). If we have a key ACQ-995-A it thinks the entries are duplicates, because the collation is case insensitive. It's rather annoying, since it's legit in mark to have a subfield 'a' different from subfield 'A' inside the same subfield. utf8_bin prevent updatedatabase.pl from breaking. http://bugs.koha-community.org/show_bug.cgi?id=13810 --- installer/data/mysql/updatedatabase.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index bd39629..2288a00 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9666,7 +9666,7 @@ if ( CheckVersion($DBversion) ) { $table_sth->execute; my @table = $table_sth->fetchrow_array; unless ( $table[1] =~ /COLLATE=utf8mb4_unicode_ci/ ) { #catches utf8mb4 collated tables - $dbh->do(qq|ALTER TABLE $name CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci|); + $dbh->do(qq|ALTER TABLE $name CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin|) } } $dbh->do(q|SET foreign_key_checks = 1|);; -- 1.7.10.4