-
Notifications
You must be signed in to change notification settings - Fork 5
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 #19 from slr71/master
CORE-1906: automatically delete job steps when the corresponding job …
- Loading branch information
Showing
2 changed files
with
38 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,19 @@ | ||
BEGIN; | ||
|
||
SET search_path = public, pg_catalog; | ||
|
||
-- | ||
-- Remove the foreign key if it already exists. | ||
-- | ||
ALTER TABLE IF EXISTS job_steps | ||
DROP CONSTRAINT job_steps_job_id_fkey; | ||
|
||
-- | ||
-- Add the foreign key back to the table without the cascade. | ||
-- | ||
ALTER TABLE IF EXISTS job_steps | ||
ADD CONSTRAINT job_steps_job_id_fkey | ||
FOREIGN KEY (job_id) | ||
REFERENCES jobs (id); | ||
|
||
COMMIT; |
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,19 @@ | ||
BEGIN; | ||
|
||
SET search_path = public, pg_catalog; | ||
|
||
-- | ||
-- Remove the foreign key if it already exists. | ||
-- | ||
ALTER TABLE IF EXISTS job_steps | ||
DROP CONSTRAINT job_steps_job_id_fkey; | ||
|
||
-- | ||
-- Add the foreign key back to the table with the cascade. | ||
-- | ||
ALTER TABLE IF EXISTS job_steps | ||
ADD CONSTRAINT job_steps_job_id_fkey | ||
FOREIGN KEY (job_id) | ||
REFERENCES jobs (id) ON DELETE CASCADE; | ||
|
||
COMMIT; |