diff options
author | Christopher Baines <mail@cbaines.net> | 2019-08-31 12:11:58 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-09-01 13:12:10 +0100 |
commit | 6b9977f62eef54678c7a53844ad5d26d8efeecb0 (patch) | |
tree | d76ededb17ec03e0705258bb9565782c7e16af76 /sqitch | |
parent | bf469504eb4df95a3349328dc10095d172630fcd (diff) | |
download | data-service-6b9977f62eef54678c7a53844ad5d26d8efeecb0.tar data-service-6b9977f62eef54678c7a53844ad5d26d8efeecb0.tar.gz |
Store lint warnings in the database
This commit adds the relevant tables and code to store lint warnings in the
database.
Currently, only lint checkers which don't require access to the network will
be run, as this allows the processing to happen without network access. Also,
this functionality won't work in older versions of Guix which don't expose the
lint warnings in a compatible way.
Diffstat (limited to 'sqitch')
-rw-r--r-- | sqitch/deploy/lint_warnings.sql | 41 | ||||
-rw-r--r-- | sqitch/revert/lint_warnings.sql | 11 | ||||
-rw-r--r-- | sqitch/sqitch.plan | 1 | ||||
-rw-r--r-- | sqitch/verify/lint_warnings.sql | 7 |
4 files changed, 60 insertions, 0 deletions
diff --git a/sqitch/deploy/lint_warnings.sql b/sqitch/deploy/lint_warnings.sql new file mode 100644 index 0000000..1051b74 --- /dev/null +++ b/sqitch/deploy/lint_warnings.sql @@ -0,0 +1,41 @@ +-- Deploy guix-data-service:lint_warnings to pg + +BEGIN; + +CREATE TABLE lint_checkers ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + name varchar NOT NULL, + description varchar NOT NULL, + network_dependent boolean NOT NULL, + UNIQUE (name, description, network_dependent) +); + +CREATE TABLE lint_warning_messages ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + locale varchar NOT NULL, + message varchar NOT NULL, + UNIQUE (locale, message) +); + +CREATE TABLE lint_warning_message_sets ( + id integer NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + message_ids integer[] NOT NULL, + UNIQUE (message_ids) +); + +CREATE TABLE lint_warnings ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + lint_checker_id integer NOT NULL, + package_id integer NOT NULL REFERENCES packages (id), + location_id integer NOT NULL REFERENCES locations (id), + lint_warning_message_set_id integer NOT NULL REFERENCES lint_warning_message_sets (id), + UNIQUE (lint_checker_id, package_id, location_id, lint_warning_message_set_id) +); + +CREATE TABLE guix_revision_lint_warnings ( + lint_warning_id integer NOT NULL REFERENCES lint_warnings (id), + guix_revision_id integer NOT NULL REFERENCES guix_revisions (id), + PRIMARY KEY (lint_warning_id, guix_revision_id) +); + +COMMIT; diff --git a/sqitch/revert/lint_warnings.sql b/sqitch/revert/lint_warnings.sql new file mode 100644 index 0000000..ea36d37 --- /dev/null +++ b/sqitch/revert/lint_warnings.sql @@ -0,0 +1,11 @@ +-- Revert guix-data-service:lint_warnings from pg + +BEGIN; + +DROP TABLE guix_revision_lint_warnings; +DROP TABLE lint_warnings; +DROP TABLE lint_warning_message_sets; +DROP TABLE lint_warning_messages; +DROP TABLE lint_checkers; + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 541074c..fb234ae 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -18,3 +18,4 @@ change_load_new_guix_revision_job_logs_contents_to_be_nullable 2019-07-07T20:10: fix_duplicated_licenses 2019-07-30T05:48:17Z Christopher Baines <mail@cbaines.net> # Fix duplicated licenses, and add constraints change_git_branches_primary_key 2019-08-05T18:57:41Z Christopher Baines <mail@cbaines.net> # Change the git_branches primary key to include the git_repository_id,\nas this will allow having the same branch in different repositories. remove_duplicate_load_new_guix_revision_jobs 2019-08-05T19:06:36Z Christopher Baines <mail@cbaines.net> # Remove duplicate load_new_guix_revision_jobs +lint_warnings 2019-08-18T17:10:12Z Christopher Baines <mail@cbaines.net> # Store lint warnings diff --git a/sqitch/verify/lint_warnings.sql b/sqitch/verify/lint_warnings.sql new file mode 100644 index 0000000..5af9a76 --- /dev/null +++ b/sqitch/verify/lint_warnings.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:lint_warnings on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; |