-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ON DELETE CASCADE to workflow tables (#13165)
- Loading branch information
1 parent
5a87f4a
commit 1437410
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
31 changes: 31 additions & 0 deletions
31
core/store/migrate/migrations/0237_add_workflow_executions_on_delete.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |