-
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.
Merge pull request #12631 from smartcontractkit/chore/release/2.10.0-…
…cherry-pick-1 Add cascade delete to kv store table fk (cherry pick)
- Loading branch information
Showing
3 changed files
with
30 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": major | ||
--- | ||
|
||
Fix kv_store migration fk cascade deletion |
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
23 changes: 23 additions & 0 deletions
23
core/store/migrate/migrations/0229_add_kv_store_job_fk_cascade_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,23 @@ | ||
-- +goose Up | ||
|
||
BEGIN; | ||
|
||
ALTER TABLE job_kv_store DROP CONSTRAINT job_kv_store_job_id_fkey; | ||
ALTER TABLE job_kv_store | ||
ADD CONSTRAINT job_kv_store_job_id_fkey | ||
FOREIGN KEY (job_id) | ||
REFERENCES jobs(id) | ||
ON DELETE CASCADE; | ||
|
||
COMMIT; | ||
|
||
-- +goose Down | ||
BEGIN; | ||
|
||
ALTER TABLE job_kv_store DROP CONSTRAINT job_kv_store_job_id_fkey; | ||
ALTER TABLE job_kv_store | ||
ADD CONSTRAINT job_kv_store_job_id_fkey | ||
FOREIGN KEY (job_id) | ||
REFERENCES jobs(id); | ||
|
||
COMMIT; |