Skip to content

Commit

Permalink
Merge pull request #19 from slr71/master
Browse files Browse the repository at this point in the history
CORE-1906: automatically delete job steps when the corresponding job …
  • Loading branch information
slr71 authored Jun 7, 2023
2 parents 9e999dc + 05e9b09 commit c3a3f2b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions migrations/000036_job_steps_fkey.down.sql
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;
19 changes: 19 additions & 0 deletions migrations/000036_job_steps_fkey.up.sql
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;

0 comments on commit c3a3f2b

Please sign in to comment.