From cb09bb0b78afdd2bf0ec6a70580bfd25fd0715d7 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 3 Oct 2022 10:34:58 +0000 Subject: [PATCH] Bug 27136: (follow-up) Make update idempotent Signed-off-by: Tomas Cohen Arazi --- .../bz27136-Add_languages_for_facet.pl | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bz27136-Add_languages_for_facet.pl b/installer/data/mysql/atomicupdate/bz27136-Add_languages_for_facet.pl index 293b1d09c3..189b6cd6dc 100644 --- a/installer/data/mysql/atomicupdate/bz27136-Add_languages_for_facet.pl +++ b/installer/data/mysql/atomicupdate/bz27136-Add_languages_for_facet.pl @@ -6,30 +6,30 @@ return { up => sub { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; - $dbh->do(q{ INSERT INTO language_subtag_registry (subtag, type, description, added) VALUES ('cr', 'language', 'Cree', now()) }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('cr', 'language', 'en', 'Cree') }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('cr', 'language', 'fr', 'Cree') }); - $dbh->do(q{ INSERT INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('cr', 'cre') }); + $dbh->do(q{ INSERT IGNORE INTO language_subtag_registry (subtag, type, description, added) VALUES ('cr', 'language', 'Cree', now()) }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('cr', 'language', 'en', 'Cree') }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('cr', 'language', 'fr', 'Cree') }); + $dbh->do(q{ INSERT IGNORE INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('cr', 'cre') }); - $dbh->do(q{ INSERT INTO language_subtag_registry (subtag, type, description, added) VALUES ('af', 'language', 'Afrikaans', now()) }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('af', 'language', 'en', 'Afrikaans') }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('af', 'language', 'fr', 'Afrikaans') }); - $dbh->do(q{ INSERT INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('af', 'afr') }); + $dbh->do(q{ INSERT IGNORE INTO language_subtag_registry (subtag, type, description, added) VALUES ('af', 'language', 'Afrikaans', now()) }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('af', 'language', 'en', 'Afrikaans') }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('af', 'language', 'fr', 'Afrikaans') }); + $dbh->do(q{ INSERT IGNORE INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('af', 'afr') }); - $dbh->do(q{ INSERT INTO language_subtag_registry (subtag, type, description, added) VALUES ('mul', 'language', 'Multiple languages', now()) }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('mul', 'language', 'en', 'Multiple languages') }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('mul', 'language', 'fr', 'Multilingue') }); - $dbh->do(q{ INSERT INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('mul', 'mul') }); + $dbh->do(q{ INSERT IGNORE INTO language_subtag_registry (subtag, type, description, added) VALUES ('mul', 'language', 'Multiple languages', now()) }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('mul', 'language', 'en', 'Multiple languages') }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('mul', 'language', 'fr', 'Multilingue') }); + $dbh->do(q{ INSERT IGNORE INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('mul', 'mul') }); - $dbh->do(q{ INSERT INTO language_subtag_registry (subtag, type, description, added) VALUES ('und', 'language', 'Undetermined', now()) }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('und', 'language', 'en', 'Undetermined') }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('und', 'language', 'fr', 'Indéterminée') }); - $dbh->do(q{ INSERT INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('und', 'und') }); + $dbh->do(q{ INSERT IGNORE INTO language_subtag_registry (subtag, type, description, added) VALUES ('und', 'language', 'Undetermined', now()) }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('und', 'language', 'en', 'Undetermined') }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('und', 'language', 'fr', 'Indéterminée') }); + $dbh->do(q{ INSERT IGNORE INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('und', 'und') }); - $dbh->do(q{ INSERT INTO language_subtag_registry (subtag, type, description, added) VALUES ('zxx', 'language', 'No linguistic content', now()) }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('zxx', 'language', 'en', 'No linguistic content') }); - $dbh->do(q{ INSERT INTO language_descriptions (subtag, type, lang, description) VALUES ('zxx', 'language', 'fr', 'Pas de contenu linguistique') }); - $dbh->do(q{ INSERT INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('zxx', 'zxx') }); + $dbh->do(q{ INSERT IGNORE INTO language_subtag_registry (subtag, type, description, added) VALUES ('zxx', 'language', 'No linguistic content', now()) }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('zxx', 'language', 'en', 'No linguistic content') }); + $dbh->do(q{ INSERT IGNORE INTO language_descriptions (subtag, type, lang, description) VALUES ('zxx', 'language', 'fr', 'Pas de contenu linguistique') }); + $dbh->do(q{ INSERT IGNORE INTO language_rfc4646_to_iso639 (rfc4646_subtag, iso639_2_code) VALUES ('zxx', 'zxx') }); say $out "Added missing languages"; }, }; -- 2.39.5