Skip to content

a8n: Add deleteCampaign mutation to GraphQL API

Administrator requested to merge a8n/delete-campaigns into master

Created by: mrnugget

Important: This is based on https://github.com/sourcegraph/sourcegraph/pull/5698 and needs to be rebased after #5698 is merged.

This adds the deleteCampaign mutation to the GraphQL. It does a simple DELETE FROM campaigns WHERE id = $id in the database. The triggers we previously setup take care of cleaning up the campaign_ids column of changesets that were connected to the campaign.


What this doesn't do is clean up now-orphaned (not connected to a campaign) changesets. We cannot consistently do that, since we our changeset mutations — createChangesets and addChangesetsToCampaign — rely on being able to connect orphaned changesets to a campaign. If we now were to delete those changesets that were previously only connected to the now-deleted campaign, we'd say that "changesets without campaign is invalid", whereas it's totally valid to first call createChangeset and then addChangesetsToCampaign.

I'm still thinking about that, but any solution should be added in a follow-up PR.

Opinions welcome!

Merge request reports

Loading