Bugzilla – Attachment 38562 Details for
Bug 13810
Prevent updatedatabase.pl from breaking because of case insensitive utf8 collation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13810: Change collate for tagsubfield (utf8_bin)
Bug-13810-Change-collate-for-tagsubfield-utf8bin.patch (text/plain), 4.10 KB, created by
Jonathan Druart
on 2015-04-27 13:50:20 UTC
(
hide
)
Description:
Bug 13810: Change collate for tagsubfield (utf8_bin)
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-04-27 13:50:20 UTC
Size:
4.10 KB
patch
obsolete
>From 1e5969686d4dc3e5554da00fddd24f51f4b162a7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 27 Apr 2015 12:38:40 +0200 >Subject: [PATCH] Bug 13810: Change collate for tagsubfield (utf8_bin) > >Before bug 11944, the marc_subfield_structure.tagsubfield column had a >specific collate: utf8_bin. It has been introduced by > commit 67e20d82ffdfcd69344ec30696bebc51c00d863c > Date: Sun Jun 22 16:35:48 2008 -0500 > DB Bump 094 - bug 2268 -- allow mixed case subfield labels in MARC21 > by changing db column collation. > >This change should be kept and Koha should continue to allow and create >subfields with the same letter but different case sensitivity. > >What does this patch: >1/ To prevent the updatedatabase entry 3.19.00.006 to fail if subfields >with different case sensitivity already exist in the DB, the table is >managed separately from others. >2/ To update DB which have already pass this dbrev, a new entry will be >create to update the specific collate for this column. > >Test plan: >1/ a. With a 3.18 DB, create subfield 'a' and 'A' for the same field > b. Execute the updatedatabase.pl script. 3.19.00.006 should not fail > anymore >2/ a. With a master DB (3.19.00.006 has already been executed), create >subfields 'a' and 'A'. You should get an error. > b. Apply this patch, execute the DB entry and try again 2/a. you > should be able to create the second subfield. >--- > .../bug_13810-modify_tagfield_collate_utf8_bin.sql | 1 + > installer/data/mysql/updatedatabase.pl | 20 +++++++++++++++++++- > 2 files changed, 20 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_13810-modify_tagfield_collate_utf8_bin.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_13810-modify_tagfield_collate_utf8_bin.sql b/installer/data/mysql/atomicupdate/bug_13810-modify_tagfield_collate_utf8_bin.sql >new file mode 100644 >index 0000000..04da934 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_13810-modify_tagfield_collate_utf8_bin.sql >@@ -0,0 +1 @@ >+ALTER TABLE marc_subfield_structure MODIFY COLUMN tagsubfield varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '' >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 49adab0..61dd129 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9711,7 +9711,25 @@ 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|); >+ if ( $name eq 'marc_subfield_structure' ) { >+ $dbh->do(q| >+ ALTER TABLE marc_subfield_structure >+ MODIFY COLUMN tagfield varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', >+ MODIFY COLUMN tagsubfield varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '', >+ MODIFY COLUMN liblibrarian varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', >+ MODIFY COLUMN libopac varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', >+ MODIFY COLUMN kohafield varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, >+ MODIFY COLUMN authorised_value varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, >+ MODIFY COLUMN authtypecode varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, >+ MODIFY COLUMN value_builder varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL, >+ MODIFY COLUMN frameworkcode varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', >+ MODIFY COLUMN seealso varchar(1100) COLLATE utf8_unicode_ci DEFAULT NULL, >+ MODIFY COLUMN link varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL >+ |); >+ } >+ else { >+ $dbh->do(qq|ALTER TABLE $name CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci|); >+ } > } > } > $dbh->do(q|SET foreign_key_checks = 1|);; >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13810
:
36744
|
37437
|
38543
|
38562
|
38664
|
38793