aboutsummaryrefslogtreecommitdiff
path: root/sqitch
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-12-26 09:28:20 +0000
committerChristopher Baines <mail@cbaines.net>2019-12-26 09:28:20 +0000
commitff01144e871b7eaa3b91a3054fa57c3dbbb19702 (patch)
treece6e42084ff3c3f4cd35031dba545c26b403988e /sqitch
parenta8d58e05413b2d66fb7b168618836625dea3de88 (diff)
downloaddata-service-ff01144e871b7eaa3b91a3054fa57c3dbbb19702.tar
data-service-ff01144e871b7eaa3b91a3054fa57c3dbbb19702.tar.gz
Create an index for the hash component of derivation filenames
This is to aid rendering of narinfo files. They're requested with the path /HASH.narinfo, so to quickly find the relevant derivation, this index can be used.
Diffstat (limited to 'sqitch')
-rw-r--r--sqitch/deploy/derivations_hash_index.sql7
-rw-r--r--sqitch/revert/derivations_hash_index.sql7
-rw-r--r--sqitch/sqitch.plan1
-rw-r--r--sqitch/verify/derivations_hash_index.sql7
4 files changed, 22 insertions, 0 deletions
diff --git a/sqitch/deploy/derivations_hash_index.sql b/sqitch/deploy/derivations_hash_index.sql
new file mode 100644
index 0000000..869ff0a
--- /dev/null
+++ b/sqitch/deploy/derivations_hash_index.sql
@@ -0,0 +1,7 @@
+-- Deploy guix-data-service:derivations_hash_index to pg
+
+BEGIN;
+
+CREATE INDEX derivations_hash ON derivations (substring(file_name from 12 for 32));
+
+COMMIT;
diff --git a/sqitch/revert/derivations_hash_index.sql b/sqitch/revert/derivations_hash_index.sql
new file mode 100644
index 0000000..dbe773b
--- /dev/null
+++ b/sqitch/revert/derivations_hash_index.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:derivations_hash_index from pg
+
+BEGIN;
+
+DROP INDEX derivations_hash;
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index c047adf..5b5659c 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -38,3 +38,4 @@ sort_out_duplicate_builds 2019-12-05T12:43:53Z <chris@phact> # Sort out duplic
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
+derivations_hash_index 2019-12-24T22:54:19Z Christopher Baines <mail@cbaines.net> # Add index on derivations for the hash component of the filename
diff --git a/sqitch/verify/derivations_hash_index.sql b/sqitch/verify/derivations_hash_index.sql
new file mode 100644
index 0000000..2c6e6b7
--- /dev/null
+++ b/sqitch/verify/derivations_hash_index.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:derivations_hash_index on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;