diff options
-rw-r--r-- | sqitch/deploy/equivalent_derivations.sql | 17 | ||||
-rw-r--r-- | sqitch/revert/equivalent_derivations.sql | 7 | ||||
-rw-r--r-- | sqitch/sqitch.plan | 1 | ||||
-rw-r--r-- | sqitch/verify/equivalent_derivations.sql | 7 |
4 files changed, 32 insertions, 0 deletions
diff --git a/sqitch/deploy/equivalent_derivations.sql b/sqitch/deploy/equivalent_derivations.sql new file mode 100644 index 0000000..3ec6ca0 --- /dev/null +++ b/sqitch/deploy/equivalent_derivations.sql @@ -0,0 +1,17 @@ +-- Deploy guix-data-service:equivalent_derivations to pg + +BEGIN; + +CREATE TABLE equivalent_derivations AS + SELECT ARRAY_AGG(derivation_id ORDER BY derivation_id ASC) AS derivation_ids, + derivation_output_details_ids + FROM ( + SELECT derivation_id, ARRAY_AGG(derivation_output_details_id ORDER BY derivation_output_details_id) AS derivation_output_details_ids + FROM derivation_outputs + GROUP BY derivation_id + ) AS derivation_output_groups + GROUP BY derivation_output_groups.derivation_output_details_ids; + +CREATE INDEX equivalent_derivations_derivation_ids ON equivalent_derivations USING GIN (derivation_ids); + +COMMIT; diff --git a/sqitch/revert/equivalent_derivations.sql b/sqitch/revert/equivalent_derivations.sql new file mode 100644 index 0000000..cf9a995 --- /dev/null +++ b/sqitch/revert/equivalent_derivations.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:equivalent_derivations from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 3b16f94..158adab 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -32,3 +32,4 @@ rework_builds 2019-11-23T20:41:20Z Christopher Baines <mail@cbaines.net> # Rewor nar_related_tables 2019-11-29T20:28:19Z Christopher Baines <mail@cbaines.net> # Add nar related tables add_index_on_builds_derivation_file_name 2019-12-03T16:23:55Z <chris@phact> # Add index on builds_derivation_file_name narinfo_fetch_record 2019-12-03T20:53:28Z <chris@phact> # Add a table to describe fetching a narinfo +equivalent_derivations 2019-12-04T16:43:37Z <chris@phact> # Add equivalent_derivations table diff --git a/sqitch/verify/equivalent_derivations.sql b/sqitch/verify/equivalent_derivations.sql new file mode 100644 index 0000000..58fafed --- /dev/null +++ b/sqitch/verify/equivalent_derivations.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:equivalent_derivations on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; |