From 4e0977949521607dfff21bacc21c6e0814b0d4db Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 30 Nov 2021 20:06:46 -0300 Subject: [PATCH] Bug 29605: (follow-up) Add language_script_mapping primary key Signed-off-by: Tomas Cohen Arazi Signed-off-by: Nick Clemens Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall --- .../data/mysql/atomicupdate/bug_29605.pl | 27 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_29605.pl diff --git a/installer/data/mysql/atomicupdate/bug_29605.pl b/installer/data/mysql/atomicupdate/bug_29605.pl new file mode 100755 index 0000000000..4a2cfe022e --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_29605.pl @@ -0,0 +1,27 @@ +use Modern::Perl; + +return { + bug_number => "29605", + description => "Add language_script_mapping primary key", + up => sub { + my ($args) = @_; + my ($dbh) = @$args{qw(dbh)}; + + if ( !primary_key_exists( 'language_script_mapping', 'language_subtag' ) + and index_exists( 'language_script_mapping', 'language_subtag' ) ) { + + $dbh->do(q{ + ALTER TABLE language_script_mapping + DROP KEY `language_subtag`; + }); + } + + if ( !primary_key_exists( 'language_script_mapping', 'language_subtag' ) ) { + + $dbh->do(q{ + ALTER TABLE language_script_mapping + ADD PRIMARY KEY `language_subtag` (`language_subtag`); + }); + } + }, +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 2077c5ab7d..6b6379cf8f 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3261,7 +3261,7 @@ DROP TABLE IF EXISTS `language_script_mapping`; CREATE TABLE `language_script_mapping` ( `language_subtag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `script_subtag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - KEY `language_subtag` (`language_subtag`) + PRIMARY KEY `language_subtag` (`language_subtag`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- 2.39.5