diff options
author | Christopher Baines <mail@cbaines.net> | 2019-11-30 10:51:58 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-11-30 10:51:58 +0000 |
commit | b6194e7b3d32d99ff4cd9f93f1438afaf489ab46 (patch) | |
tree | 155215c4d50ee5186fe5b9520365f53534f3e30a /sqitch | |
parent | 20c75e11038de62efd9fe8ae6ce41782f5a18172 (diff) | |
download | data-service-b6194e7b3d32d99ff4cd9f93f1438afaf489ab46.tar data-service-b6194e7b3d32d99ff4cd9f93f1438afaf489ab46.tar.gz |
Begin to add support for importing narinfo files
This commit adds the tables, as well as code to support extracting data from
narinfo files.
Diffstat (limited to 'sqitch')
-rw-r--r-- | sqitch/deploy/nar_related_tables.sql | 53 | ||||
-rw-r--r-- | sqitch/revert/nar_related_tables.sql | 12 | ||||
-rw-r--r-- | sqitch/sqitch.plan | 1 | ||||
-rw-r--r-- | sqitch/verify/nar_related_tables.sql | 7 |
4 files changed, 73 insertions, 0 deletions
diff --git a/sqitch/deploy/nar_related_tables.sql b/sqitch/deploy/nar_related_tables.sql new file mode 100644 index 0000000..50bf9b0 --- /dev/null +++ b/sqitch/deploy/nar_related_tables.sql @@ -0,0 +1,53 @@ +-- Deploy guix-data-service:nar_related_tables to pg + +BEGIN; + +CREATE TABLE nars ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + store_path varchar NOT NULL, + hash_algorithm varchar NOT NULL, + hash varchar NOT NULL, + size integer NOT NULL, + system varchar, + deriver varchar +); + +CREATE TABLE nar_urls ( + nar_id integer NOT NULL REFERENCES nars(id), + url varchar PRIMARY KEY, + compression varchar NOT NULL, + file_size integer NOT NULL +); + +CREATE TABLE nar_references ( + nar_id integer NOT NULL REFERENCES nars(id), + reference varchar NOT NULL +); + +CREATE TABLE narinfo_signature_public_keys ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + sexp_json jsonb NOT NULL, + UNIQUE (sexp_json) +); + +CREATE TABLE narinfo_signature_data ( + id integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY, + version integer NOT NULL, + host_name varchar NOT NULL, + data_hash varchar NOT NULL, + data_hash_algorithm varchar NOT NULL, + data_json jsonb NOT NULL, + sig_val_json jsonb NOT NULL, + narinfo_signature_public_key_id integer NOT NULL REFERENCES narinfo_signature_public_keys(id), + narinfo_body varchar NOT NULL, + narinfo_signature_line varchar NOT NULL, + UNIQUE (narinfo_signature_line) +); + +CREATE TABLE narinfo_signatures ( + nar_id integer NOT NULL REFERENCES nars(id), + narinfo_signature_data_id integer NOT NULL REFERENCES narinfo_signature_data(id), + UNIQUE (nar_id, narinfo_signature_data_id) +); + +COMMIT; diff --git a/sqitch/revert/nar_related_tables.sql b/sqitch/revert/nar_related_tables.sql new file mode 100644 index 0000000..eeb1e9c --- /dev/null +++ b/sqitch/revert/nar_related_tables.sql @@ -0,0 +1,12 @@ +-- Revert guix-data-service:nar_related_tables from pg + +BEGIN; + +DROP TABLE narinfo_signatures; +DROP TABLE narinfo_signature_data; +DROP TABLE narinfo_signature_public_keys; +DROP TABLE nar_references; +DROP TABLE nar_urls; +DROP TABLE nars; + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 5990567..c6de817 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -29,3 +29,4 @@ package_derivations_by_guix_revision_range 2019-11-09T19:09:48Z Christopher Bain channel_news_tables 2019-11-15T07:32:07Z Christopher Baines <mail@cbaines.net> # Add tables to store channel news build_server_token_seeds 2019-11-23T09:26:48Z Christopher Baines <mail@cbaines.net> # Add build_server_token_seeds table rework_builds 2019-11-23T20:41:20Z Christopher Baines <mail@cbaines.net> # Rework the build tables +nar_related_tables 2019-11-29T20:28:19Z Christopher Baines <mail@cbaines.net> # Add nar related tables diff --git a/sqitch/verify/nar_related_tables.sql b/sqitch/verify/nar_related_tables.sql new file mode 100644 index 0000000..ae5c0e7 --- /dev/null +++ b/sqitch/verify/nar_related_tables.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:nar_related_tables on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; |