guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/06: Change a constraint to add ON DELETE CASCADE


From: Christopher Baines
Subject: 03/06: Change a constraint to add ON DELETE CASCADE
Date: Fri, 2 Oct 2020 15:15:39 -0400 (EDT)

cbaines pushed a commit to branch master
in repository data-service.

commit 841f5fb18697a545f083e48e2b1e3ab47e4312e4
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Fri Oct 2 18:14:40 2020 +0100

    Change a constraint to add ON DELETE CASCADE
    
    I've not used these in many places, to try and avoid hiding deleting data, 
but
    in this case, this will allow more easily deleting the derivation source 
file
    nars, by just deleting the derivation_source_files table entry.
---
 .../change_derivation_source_file_nars_constraint.sql       | 13 +++++++++++++
 .../change_derivation_source_file_nars_constraint.sql       |  7 +++++++
 sqitch/sqitch.plan                                          |  1 +
 .../change_derivation_source_file_nars_constraint.sql       |  7 +++++++
 4 files changed, 28 insertions(+)

diff --git a/sqitch/deploy/change_derivation_source_file_nars_constraint.sql 
b/sqitch/deploy/change_derivation_source_file_nars_constraint.sql
new file mode 100644
index 0000000..b8e96a2
--- /dev/null
+++ b/sqitch/deploy/change_derivation_source_file_nars_constraint.sql
@@ -0,0 +1,13 @@
+-- Deploy guix-data-service:change_derivation_source_file_nars_constraint to pg
+
+BEGIN;
+
+ALTER TABLE derivation_source_file_nars
+  DROP CONSTRAINT derivation_source_file_nars_derivation_source_file_id_fkey;
+
+ALTER TABLE derivation_source_file_nars
+  ADD CONSTRAINT derivation_source_file_nars_derivation_source_file_id_fkey
+  FOREIGN KEY (derivation_source_file_id) REFERENCES 
derivation_source_files(id)
+  ON DELETE CASCADE;
+
+COMMIT;
diff --git a/sqitch/revert/change_derivation_source_file_nars_constraint.sql 
b/sqitch/revert/change_derivation_source_file_nars_constraint.sql
new file mode 100644
index 0000000..a2143f8
--- /dev/null
+++ b/sqitch/revert/change_derivation_source_file_nars_constraint.sql
@@ -0,0 +1,7 @@
+-- Revert guix-data-service:change_derivation_source_file_nars_constraint from 
pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
diff --git a/sqitch/sqitch.plan b/sqitch/sqitch.plan
index 95d0392..09df4bb 100644
--- a/sqitch/sqitch.plan
+++ b/sqitch/sqitch.plan
@@ -70,3 +70,4 @@ add-tsvectors-per-locale 2020-07-16T18:19:44Z daniela 
<daniela@linux-ijv5> # Add
 change_package_descriptions_index 2020-08-23T11:56:00Z Christopher Baines 
<mail@cbaines.net> # Change the package_descriptions index
 change_locale_values 2020-09-26T10:20:22Z Christopher Baines 
<mail@cbaines.net> # Change locale values
 change_autovacuum_config 2020-10-01T21:24:46Z Christopher Baines 
<mail@cbaines.net> # Change autovacuum config
+change_derivation_source_file_nars_constraint 2020-10-02T17:12:58Z Christopher 
Baines <mail@cbaines.net> # Change derivation source file nars constraint
diff --git a/sqitch/verify/change_derivation_source_file_nars_constraint.sql 
b/sqitch/verify/change_derivation_source_file_nars_constraint.sql
new file mode 100644
index 0000000..7c00429
--- /dev/null
+++ b/sqitch/verify/change_derivation_source_file_nars_constraint.sql
@@ -0,0 +1,7 @@
+-- Verify guix-data-service:change_derivation_source_file_nars_constraint on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]