I'm managing a SQL Server database, via DACPAC releases in Azure DevOps. My project is currently in development but I anticipate development continuing after Prod go-live.
By default I have the Publish configuration set to b0rk if dataloss is about to occur, especially in Prod - the majority of changes shouldn't cause it, and my instinct is that overall DataLoss is more likely to be indicative of a bug, than of intentional data abandonment.
But naturally, I expect that there will be SOME occasions on which a migration knowingly discards data, and that this is expected and OK.
I'd like to set up DevOps in such a way that I can achieve that, in a controlled and robust way. What's the best way to achieve this?
My ideal would be something that essentially said "yes, deploy this release ... Yes, I know that it will cause dataloss, that's fine."
I have one idea, which I'll post as an answer. But I'm looking for other ideas, or any "standard" or "official" approaches. (Or just better ideas :D )
DevOps allows you to pass parameters to
SqlPackage.exe
, one of which controls how the DACPAC responds to potential DataLoss:/p:BlockOnPossibleDataLoss=false
Since DevOps Releases pipelines are themselves parameterisable, via release "Variables", and the Variables can be edited within a particular release without affecting the default settings.
So one could simply parameterise the value passed into
SqlPackage.exe
, and thus create a release which either does or does not allow DataLoss based on that variable, and when you need to release something that does require DataLoss, create a release and set the Variable accordingly.Edit: Worked Fine