Skip to content

Commit

Permalink
Add ON DELETE CASCADE to workflow tables (#13165)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier committed May 29, 2024
1 parent da166da commit de3c1e8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-mice-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#db_update Add ON DELETE CASCADE to workflow tables
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE workflow_executions
DROP CONSTRAINT workflow_executions_workflow_id_fkey,
ADD CONSTRAINT workflow_executions_workflow_id_fkey
FOREIGN KEY (workflow_id)
REFERENCES workflow_specs(workflow_id)
ON DELETE CASCADE;

ALTER TABLE workflow_steps
DROP CONSTRAINT workflow_steps_workflow_execution_id_fkey,
ADD CONSTRAINT workflow_steps_workflow_execution_id_fkey
FOREIGN KEY (workflow_execution_id)
REFERENCES workflow_executions(id)
ON DELETE CASCADE;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
ALTER TABLE workflow_executions
DROP CONSTRAINT workflow_executions_workflow_id_fkey,
ADD CONSTRAINT workflow_executions_workflow_id_fkey
FOREIGN KEY (workflow_id)
REFERENCES workflow_specs(workflow_id);

ALTER TABLE workflow_steps
DROP CONSTRAINT workflow_steps_workflow_execution_id_fkey,
ADD CONSTRAINT workflow_steps_workflow_execution_id_fkey
FOREIGN KEY (workflow_execution_id)
REFERENCES workflow_executions(id);
-- +goose StatementEnd

0 comments on commit de3c1e8

Please sign in to comment.