From 9bf6abcf37b342285976b9ef8409f42d4fe1c018 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 30 Nov 2021 10:56:53 -0300 Subject: [PATCH] Bug 15067: (QA follow-up) Add missing UNIQUE constraint in kohastructure.sql To test: 1. Run: $ reset_all $ koha-mysql kohadev > SHOW CREATE TABLE language_descriptions; => FAIL: There is KEY `subtag_type_lang` (`subtag`,`type`,`lang`) 2. Apply this patch 3. Repeat 1 => SUCCESS: UNIQUE KEY `subtag_type_lang` (`subtag`,`type`,`lang`) Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind --- Koha/Schema/Result/LanguageDescription.pm | 22 ++++++++++++++++++++-- installer/data/mysql/kohastructure.sql | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Koha/Schema/Result/LanguageDescription.pm b/Koha/Schema/Result/LanguageDescription.pm index aed9cb67ec..e6352c9ab9 100644 --- a/Koha/Schema/Result/LanguageDescription.pm +++ b/Koha/Schema/Result/LanguageDescription.pm @@ -80,9 +80,27 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); +=head1 UNIQUE CONSTRAINTS -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fQEN7ks3f7aLuoDQWqEv+Q +=head2 C + +=over 4 + +=item * L + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("subtag_type_lang", ["subtag", "type", "lang"]); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-11-30 13:58:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:47kn6QYcK/PKIvsxwsUl0w # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index a309cea736..7a93981326 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3216,7 +3216,7 @@ CREATE TABLE `language_descriptions` ( `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`), KEY `lang` (`lang`), - KEY `subtag_type_lang` (`subtag`,`type`,`lang`) + UNIQUE KEY `subtag_type_lang` (`subtag`,`type`,`lang`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- 2.20.1