diff options
author | Christopher Baines <mail@cbaines.net> | 2019-12-07 19:27:31 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-12-12 20:07:22 +0000 |
commit | c8b93cb0d02abfbf0a8162ed221b9fac83fed715 (patch) | |
tree | 1c3c8c4d7936280d5a34df0ec4b66e52edabe355 /sqitch | |
parent | a965ba1f6afe182c3c4723a676d4ca0c6c53e4d7 (diff) | |
download | data-service-c8b93cb0d02abfbf0a8162ed221b9fac83fed715.tar data-service-c8b93cb0d02abfbf0a8162ed221b9fac83fed715.tar.gz |
Add new derivation_output_details_set_id column to the builds table
As this will hopefully provide a faster way of associating derivations with
builds.
Diffstat (limited to 'sqitch')
4 files changed, 37 insertions, 0 deletions
diff --git a/sqitch/deploy/builds_add_derivation_output_details_set_id.sql b/sqitch/deploy/builds_add_derivation_output_details_set_id.sql new file mode 100644 index 0000000..692e25c --- /dev/null +++ b/sqitch/deploy/builds_add_derivation_output_details_set_id.sql @@ -0,0 +1,22 @@ +-- Deploy guix-data-service:builds_add_derivation_output_details_set_id to pg + +BEGIN; + +ALTER TABLE builds + ADD COLUMN derivation_output_details_set_id integer + NULL + DEFAULT NULL + REFERENCES derivation_output_details_sets (id); + +UPDATE builds SET derivation_output_details_set_id = ( + SELECT derivations_by_output_details_set.derivation_output_details_set_id + FROM derivations_by_output_details_set + INNER JOIN derivations + ON derivations.file_name = builds.derivation_file_name + WHERE derivations_by_output_details_set.derivation_id = derivations.id +); + +CREATE INDEX builds_derivation_output_details_set_id ON + builds (derivation_output_details_set_id); + +COMMIT; diff --git a/sqitch/revert/builds_add_derivation_output_details_set_id.sql b/sqitch/revert/builds_add_derivation_output_details_set_id.sql new file mode 100644 index 0000000..97a5954 --- /dev/null +++ b/sqitch/revert/builds_add_derivation_output_details_set_id.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:builds_add_derivation_output_details_set_id from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index 2f5b512..c047adf 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -37,3 +37,4 @@ change_nar_urls_size_to_bigint 2019-12-04T21:49:07Z <chris@phact> # Change nar sort_out_duplicate_builds 2019-12-05T12:43:53Z <chris@phact> # Sort out duplicate builds add_some_database_indexes 2019-12-05T15:53:04Z Christopher Baines <mail@cbaines.net> # Add some indexes derivation_output_sets 2019-12-05T23:19:05Z Christopher Baines <mail@cbaines.net> # Describe the sets of derivation outputs +builds_add_derivation_output_details_set_id 2019-12-07T18:25:38Z Christopher Baines <mail@cbaines.net> # Add a derivation_output_details_set_id column to builds diff --git a/sqitch/verify/builds_add_derivation_output_details_set_id.sql b/sqitch/verify/builds_add_derivation_output_details_set_id.sql new file mode 100644 index 0000000..fc91296 --- /dev/null +++ b/sqitch/verify/builds_add_derivation_output_details_set_id.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:builds_add_derivation_output_details_set_id on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; |