diff --git a/migrations/000036_job_steps_fkey.down.sql b/migrations/000036_job_steps_fkey.down.sql new file mode 100644 index 0000000..d101607 --- /dev/null +++ b/migrations/000036_job_steps_fkey.down.sql @@ -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; diff --git a/migrations/000036_job_steps_fkey.up.sql b/migrations/000036_job_steps_fkey.up.sql new file mode 100644 index 0000000..fbd875e --- /dev/null +++ b/migrations/000036_job_steps_fkey.up.sql @@ -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;