Do not expire the PreviousChangesetSpec of a changeset
Created by: mrnugget
We expire CampaignSpecs and ChangesetSpecs in repo-updater:
When do we expire?
-
CampaignSpecsare expired when they're not attached to aCampaignanymore. -
ChangesetSpecsare expired when they're not attached to aCampaignSpec.
But since we extended ApplyCampaign we now have a CurrentSpecID and a PreviousSpecID on Changesets and set those:
That means ApplyCampaign can leave us in a state where a Changeset has a PreviousSpecID that points to a ChangesetSpec that is attached to a CampaignSpec that's not attached to a campaign.
What we need to do:
- Continue to expire
campaignSpecthat are not attached tocampaignsanymore. - But don't clean up the
ChangesetSpecsif they're attached to aChangeset, either as aCurrentSpecIDor aPreviousSpecID.
For that we need to find out whether the deletion of a campaign_spec also deletes the associated changeset_specs. if that's the case, we need to stop.
And then, in DeleteExpiredChangesetSpecs, we need to not delete ChangesetSpecs that are attached to a changeset.