From 3f3801d0dde9ffe83eec2789dbaf8c4be40a9280 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 5 Dec 2019 14:09:06 +0100 Subject: WIP equivalent derivations --- sqitch/deploy/equivalent_derivations.sql | 17 +++++++++++++++++ sqitch/revert/equivalent_derivations.sql | 7 +++++++ sqitch/sqitch.plan | 1 + sqitch/verify/equivalent_derivations.sql | 7 +++++++ 4 files changed, 32 insertions(+) create mode 100644 sqitch/deploy/equivalent_derivations.sql create mode 100644 sqitch/revert/equivalent_derivations.sql create mode 100644 sqitch/verify/equivalent_derivations.sql 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 # Rewor nar_related_tables 2019-11-29T20:28:19Z Christopher Baines # Add nar related tables add_index_on_builds_derivation_file_name 2019-12-03T16:23:55Z # Add index on builds_derivation_file_name narinfo_fetch_record 2019-12-03T20:53:28Z # Add a table to describe fetching a narinfo +equivalent_derivations 2019-12-04T16:43:37Z # 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; -- cgit v1.2.3