Bugzilla – Attachment 128238 Details for
Bug 29631
21.06.000.12 may fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29631: Prevent uniq_lang creation to fail
Bug-29631-Prevent-uniqlang-creation-to-fail.patch (text/plain), 1.68 KB, created by
David Nind
on 2021-12-03 23:28:18 UTC
(
hide
)
Description:
Bug 29631: Prevent uniq_lang creation to fail
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-12-03 23:28:18 UTC
Size:
1.68 KB
patch
obsolete
>From 4c2f6ea384b9216e9ba1c0a089d8849a0d7259bf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 3 Dec 2021 14:33:41 +0100 >Subject: [PATCH] Bug 29631: Prevent uniq_lang creation to fail > >We got 2 reports of this problem in the last 24h, uniq_lang unique key is failing to be created because several rows with the same (subtag, type) exist in DB. > >I have no idea how this is possible, but apparently it is. > >Test plan: >Checkout a commit before 21.06.00.012 >reset_all >Create duplicate in language_subtag_registry >> insert into language_subtag_registry(subtag, type, description) values('IN', 'region', 'India'); >Checkout master+this patch, updatedatabase >=> Only 1 IN-region exists in the DB, the last one. > >Signed-off-by: David Nind <david@davidnind.com> >--- > installer/data/mysql/db_revs/210600012.pl | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/installer/data/mysql/db_revs/210600012.pl b/installer/data/mysql/db_revs/210600012.pl >index fef986078b..361a6056fc 100755 >--- a/installer/data/mysql/db_revs/210600012.pl >+++ b/installer/data/mysql/db_revs/210600012.pl >@@ -8,6 +8,15 @@ return { > my $dbh = $args->{dbh}; > > if( !unique_key_exists( 'language_subtag_registry', 'uniq_lang' ) ) { >+ >+ $dbh->do(q{ >+ DELETE a >+ FROM language_subtag_registry AS a, language_subtag_registry AS b >+ WHERE a.id < b.id >+ AND a.subtag IS NOT NULL >+ AND a.subtag=b.subtag >+ AND a.type=b.type >+ }); > $dbh->do(q{ > ALTER TABLE language_subtag_registry > ADD UNIQUE KEY uniq_lang (subtag, type) >-- >2.20.1
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 29631
:
128209
|
128214
|
128238
|
128434
|
128435