aboutsummaryrefslogtreecommitdiff
path: root/sqitch/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'sqitch/deploy')
-rw-r--r--sqitch/deploy/cascade_nar_foreign_keys.sql35
-rw-r--r--sqitch/deploy/nar_indexes.sql9
2 files changed, 44 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;