From 56d360350561ea27399c03c208542f8be2313891 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Fri, 21 Jul 2023 20:40:46 +0200 Subject: [PATCH] fix(filters): could not delete with postgres (#1021) * fix(filters): could not delete with postgres * fix(migrations): add actions constraint to base schema --- internal/database/postgres_migrate.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/database/postgres_migrate.go b/internal/database/postgres_migrate.go index f78bc5b..9910c9c 100644 --- a/internal/database/postgres_migrate.go +++ b/internal/database/postgres_migrate.go @@ -283,7 +283,7 @@ CREATE TABLE release_action_status raw TEXT, log TEXT, release_id INTEGER NOT NULL, - FOREIGN KEY (action_id) REFERENCES "action"(id), + FOREIGN KEY (action_id) REFERENCES "action"(id) ON DELETE SET NULL, FOREIGN KEY (release_id) REFERENCES "release"(id) ON DELETE CASCADE, FOREIGN KEY (filter_id) REFERENCES "filter"(id) ON DELETE SET NULL ); @@ -706,4 +706,11 @@ ADD COLUMN use_bouncer BOOLEAN DEFAULT FALSE; ALTER TABLE irc_network ADD COLUMN bouncer_addr TEXT;`, + `ALTER TABLE release_action_status + DROP CONSTRAINT release_action_status_action_id_fkey; + +ALTER TABLE release_action_status + ADD FOREIGN KEY (action_id) REFERENCES action + ON DELETE SET NULL; + `, }