From f67bea719d07cf48818bc0c2a1adca4edb291cd7 Mon Sep 17 00:00:00 2001 From: Danjela Lura Date: Thu, 28 May 2020 22:17:11 +0200 Subject: Get the translated lint checker descriptions into the database Signed-off-by: Christopher Baines --- .../translations_for_lint_checker_descriptions.sql | 40 ++++++++++++++++++++++ .../translations_for_lint_checker_descriptions.sql | 7 ++++ sqitch/sqitch.plan | 1 + .../translations_for_lint_checker_descriptions.sql | 7 ++++ 4 files changed, 55 insertions(+) create mode 100644 sqitch/deploy/translations_for_lint_checker_descriptions.sql create mode 100644 sqitch/revert/translations_for_lint_checker_descriptions.sql create mode 100644 sqitch/verify/translations_for_lint_checker_descriptions.sql (limited to 'sqitch') diff --git a/sqitch/deploy/translations_for_lint_checker_descriptions.sql b/sqitch/deploy/translations_for_lint_checker_descriptions.sql new file mode 100644 index 0000000..3a2ed8e --- /dev/null +++ b/sqitch/deploy/translations_for_lint_checker_descriptions.sql @@ -0,0 +1,40 @@ +-- Deploy guix-data-service:translations_for_lint_checker_descriptions to pg + +BEGIN; + +CREATE TABLE lint_checker_descriptions ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + locale varchar NOT NULL, + description varchar NOT NULL, + UNIQUE (locale, description) +); + +CREATE TABLE lint_checker_description_sets ( + id integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + description_ids integer[] NOT NULL, + UNIQUE (description_ids) +); + +ALTER TABLE lint_checkers ADD COLUMN lint_checker_description_set_id integer REFERENCES lint_checker_description_sets(id); + +INSERT INTO lint_checker_descriptions(locale, description) +SELECT DISTINCT 'en_US.utf8', description + FROM lint_checkers; + +INSERT INTO lint_checker_description_sets (description_ids) +SELECT DISTINCT ARRAY_AGG( + id) + FROM lint_checker_descriptions + GROUP BY id; + +UPDATE lint_checkers + SET lint_checker_description_set_id = + lint_checker_description_sets.id + FROM lint_checker_description_sets + INNER JOIN lint_checker_descriptions + ON lint_checker_description_sets.description_ids[1] = lint_checker_descriptions.id + WHERE lint_checkers.description = lint_checker_descriptions.description; + +ALTER TABLE lint_checkers DROP COLUMN description; + +COMMIT; diff --git a/sqitch/revert/translations_for_lint_checker_descriptions.sql b/sqitch/revert/translations_for_lint_checker_descriptions.sql new file mode 100644 index 0000000..a310ea5 --- /dev/null +++ b/sqitch/revert/translations_for_lint_checker_descriptions.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:translations_for_lint_checker_descriptions from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index cb57737..911c43b 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -59,3 +59,4 @@ load_new_guix_revision_jobs_make_commits_unique 2020-03-27T21:38:42Z Christopher remove_odd_package_derivations 2020-04-24T20:36:06Z Christopher Baines # Remove odd package derivations build_servers_lookup_builds 2020-05-24T15:18:09Z Christopher Baines # Add build_servers.lookup_builds make_nar_urls_file_size_optional 2020-06-03T05:27:29Z Christopher Baines # Make the nar_urls.file_size optional +translations_for_lint_checker_descriptions 2020-05-22T19:49:37Z daniela # Support translations for lint checker descriptions diff --git a/sqitch/verify/translations_for_lint_checker_descriptions.sql b/sqitch/verify/translations_for_lint_checker_descriptions.sql new file mode 100644 index 0000000..7736f88 --- /dev/null +++ b/sqitch/verify/translations_for_lint_checker_descriptions.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:translations_for_lint_checker_descriptions on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; -- cgit v1.2.3