dbjobqueue: Alter foreign key constraints
When deleting rows from the job table, make sure the delete is cascaded to the dependencies and heartbeat tables.
This commit is contained in:
parent
feb357e538
commit
9bff4a4f0f
2 changed files with 17 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
ALTER TABLE job_dependencies
|
||||
|
||||
DROP CONSTRAINT job_dependencies_dependency_id_fkey,
|
||||
|
||||
DROP CONSTRAINT job_dependencies_job_id_fkey,
|
||||
|
||||
ADD CONSTRAINT job_dependencies_dependency_id_fkey
|
||||
FOREIGN KEY (job_id) REFERENCES jobs(id) ON DELETE CASCADE,
|
||||
|
||||
ADD CONSTRAINT job_dependencies_job_id_fkey
|
||||
FOREIGN KEY (dependency_id) REFERENCES jobs(id) ON DELETE CASCADE;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
ALTER TABLE heartbeats
|
||||
|
||||
DROP CONSTRAINT heartbeats_id_fkey,
|
||||
|
||||
ADD CONSTRAINT heartbeats_id_fkey
|
||||
FOREIGN KEY (id) REFERENCES jobs(id) ON DELETE CASCADE;
|
||||
Loading…
Add table
Add a link
Reference in a new issue