diff options
-rw-r--r-- | sqitch/deploy/cascade_nar_foreign_keys.sql | 35 | ||||
-rw-r--r-- | sqitch/deploy/nar_indexes.sql | 9 | ||||
-rw-r--r-- | sqitch/revert/cascade_nar_foreign_keys.sql | 7 | ||||
-rw-r--r-- | sqitch/revert/nar_indexes.sql | 7 | ||||
-rw-r--r-- | sqitch/sqitch.plan | 2 | ||||
-rw-r--r-- | sqitch/verify/cascade_nar_foreign_keys.sql | 7 | ||||
-rw-r--r-- | sqitch/verify/nar_indexes.sql | 7 |
7 files changed, 74 insertions, 0 deletions
diff --git a/sqitch/deploy/cascade_nar_foreign_keys.sql b/sqitch/deploy/cascade_nar_foreign_keys.sql new file mode 100644 index 0000000..8e01139 --- /dev/null +++ b/sqitch/deploy/cascade_nar_foreign_keys.sql @@ -0,0 +1,35 @@ +-- Deploy guix-data-service:cascade_nar_foreign_keys to pg + +BEGIN; + +ALTER TABLE narinfo_fetch_records + DROP CONSTRAINT narinfo_fetch_records_narinfo_signature_data_id_fkey, + ADD CONSTRAINT narinfo_fetch_records_narinfo_signature_data_id_fkey + FOREIGN KEY (narinfo_signature_data_id) REFERENCES narinfo_signature_data(id) + ON DELETE CASCADE; + +ALTER TABLE narinfo_signatures + DROP CONSTRAINT narinfo_signatures_nar_id_fkey, + ADD CONSTRAINT narinfo_signatures_nar_id_fkey + FOREIGN KEY (nar_id) REFERENCES nars(id) + ON DELETE CASCADE; + +ALTER TABLE narinfo_signatures + DROP CONSTRAINT narinfo_signatures_narinfo_signature_data_id_fkey, + ADD CONSTRAINT narinfo_signatures_narinfo_signature_data_id_fkey + FOREIGN KEY (narinfo_signature_data_id) REFERENCES narinfo_signature_data(id) + ON DELETE CASCADE; + +ALTER TABLE nar_references + DROP CONSTRAINT "nar_references_nar_id_fkey", + ADD CONSTRAINT "nar_references_nar_id_fkey" + FOREIGN KEY (nar_id) REFERENCES nars(id) + ON DELETE CASCADE; + +ALTER TABLE nar_urls + DROP CONSTRAINT "nar_urls_nar_id_fkey", + ADD CONSTRAINT "nar_urls_nar_id_fkey" + FOREIGN KEY (nar_id) REFERENCES nars(id) + ON DELETE CASCADE; + +COMMIT; diff --git a/sqitch/deploy/nar_indexes.sql b/sqitch/deploy/nar_indexes.sql new file mode 100644 index 0000000..baaeb00 --- /dev/null +++ b/sqitch/deploy/nar_indexes.sql @@ -0,0 +1,9 @@ +-- Deploy guix-data-service:nar_indexes to pg + +BEGIN; + +CREATE INDEX narinfo_signatures_narinfo_signature_data_id ON narinfo_signatures (narinfo_signature_data_id);;;; + +CREATE INDEX nar_references_nar_id ON nar_references (nar_id); + +COMMIT; diff --git a/sqitch/revert/cascade_nar_foreign_keys.sql b/sqitch/revert/cascade_nar_foreign_keys.sql new file mode 100644 index 0000000..2e9d7f3 --- /dev/null +++ b/sqitch/revert/cascade_nar_foreign_keys.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:cascade_nar_foreign_keys from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/revert/nar_indexes.sql b/sqitch/revert/nar_indexes.sql new file mode 100644 index 0000000..f98c6b8 --- /dev/null +++ b/sqitch/revert/nar_indexes.sql @@ -0,0 +1,7 @@ +-- Revert guix-data-service:nar_indexes from pg + +BEGIN; + +-- XXX Add DDLs here. + +COMMIT; diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan index caab662..a3f8952 100644 --- a/sqitch/sqitch.plan +++ b/sqitch/sqitch.plan @@ -94,3 +94,5 @@ package_derivations_extended_statistics 2022-11-12T10:40:18Z Chris <chris@felis> derivation_outputs_id_and_derivation_id_idx 2022-11-12T10:41:42Z Chris <chris@felis> # Add index on derivation_outputs id and derivation_id blocked_builds_blocked_builds_blocked_derivation_output_details_set_id_2 2023-03-05T10:19:53Z Chris <chris@felis> # Add index on blocked_builds_blocked_derivation_output_details_set_id guix_revision_package_derivation_distribution_counts 2023-03-08T16:53:44Z Chris <chris@felis> # Add guix_revision_package_derivation_distribution_counts table +cascade_nar_foreign_keys 2023-08-01T09:42:33Z Chris <chris@felis> # Make it easier to delete nars entries +nar_indexes 2023-08-01T11:37:35Z Chris <chris@felis> # Add nar related indexes diff --git a/sqitch/verify/cascade_nar_foreign_keys.sql b/sqitch/verify/cascade_nar_foreign_keys.sql new file mode 100644 index 0000000..f292949 --- /dev/null +++ b/sqitch/verify/cascade_nar_foreign_keys.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:cascade_nar_foreign_keys on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; diff --git a/sqitch/verify/nar_indexes.sql b/sqitch/verify/nar_indexes.sql new file mode 100644 index 0000000..3e2f519 --- /dev/null +++ b/sqitch/verify/nar_indexes.sql @@ -0,0 +1,7 @@ +-- Verify guix-data-service:nar_indexes on pg + +BEGIN; + +-- XXX Add verifications here. + +ROLLBACK; |