2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00

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.
This commit is contained in:
Christopher Baines 2020-10-02 18:14:40 +01:00
parent 125a35fce5
commit 841f5fb186
4 changed files with 28 additions and 0 deletions

View file

@ -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;

View file

@ -0,0 +1,7 @@
-- Revert guix-data-service:change_derivation_source_file_nars_constraint from pg
BEGIN;
-- XXX Add DDLs here.
COMMIT;

View file

@ -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

View file

@ -0,0 +1,7 @@
-- Verify guix-data-service:change_derivation_source_file_nars_constraint on pg
BEGIN;
-- XXX Add verifications here.
ROLLBACK;