a8n: Fix deletion of repos that are associated with Campaigns/CampaignPlans
Created by: mrnugget
This fixes #6727 (closed) by implementing the non-enhanced version as described in this comment: https://github.com/sourcegraph/sourcegraph/issues/6727#issuecomment-558510097
- The syncer now works again even if there was a Campaign/CampaignPlan that has a reference to a repository that's to be delted.
- Deleting a repository also deletes the related
campaign_job
,changeset_job
,changeset
and removes those from thecampaign
. - Changesets remain on the code host when a local entity related to a changset is deleted.
What this does NOT include are the enhanced features:
- Closing Changesets on the codehost when closing a campaign
- Instead of removing changesets from a campaign upon repository deletion, they're shown in a "associated repository no longer exists" state
- Site admins are warned that changing an external service config will remove repositories that are part of a campaign