a8n: Non-manual Campaigns cannot be deleted due to foreign-key constraint
Created by: mrnugget
When trying to delete a Campaign
in the UI that has ChangesetJobs
(and Changesets
) I get the following message:
pq: update or delete on table "campaigns" violates foreign key constraint "changeset_jobs_campaign_id_fkey" on table "changeset_jobs"
I think we have two options. We either
- change the
campaign_id
column definition onchangeset_jobs
to have aDELETE CASCADE
- we change the
deleteCampaign
mutation to load theChangesetJobs
from the database and delete them manually (while we're at it, we could also delete theCampaignPlan
and itsCampaignJobs
in the same transaction)