Skip to content

Commit

Permalink
Add ON DELETE CASCADE to workflow tables
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier committed May 9, 2024
1 parent dc94178 commit 95bdb7f
Showing 1 changed file with 31 additions and 0 deletions.
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 95bdb7f

Please sign in to comment.