Bug 29631: Prevent uniq_lang creation to fail
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 3 Dec 2021 13:33:41 +0000 (14:33 +0100)
committerKyle Hall <kyle@bywatersolutions.com>
Fri, 17 Dec 2021 13:44:42 +0000 (08:44 -0500)
commitd65f0d751cde38b2a1329c1714a0583a1c84d4ca
treeb66289d99616bfd6274d24d05e1a3e0ae1547342
parentd8c5c195c9d6a489c7e63a618b078275ede8c62c
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
installer/data/mysql/db_revs/210600012.pl