Home > other >  Why is Azure CI DACPAC trying to drop a column that doesn't exist and failing?
Why is Azure CI DACPAC trying to drop a column that doesn't exist and failing?

Time:12-09

I'm trying to deploy DB updates to SQL Server via Azure CI DACPAC, but I keep getting a data loss might occur error causing the deployment to fail.

Warning SQL72015: The column [dbo].[MyTable].[NonExistantField] is being dropped, data loss could occur.

Why would it try to drop a column that doesn't exist? There's no reference to this field that I can find anywhere. How do I get it to stop trying to drop the column?

Secondly, and more generally, is there a setting somewhere where I can force it to deploy even if data loss occurs? I don't care about data loss, it's irrelevant and this error forces me to update the entire database by hand.

CodePudding user response:

That depends on how you are trying to deploy your updates. It will be useful to see your deployment step to get some recommendations. As an example, if you deploy through SqlPackage, you can use /p:BlockOnPossibleDataLoss='False' option.

CodePudding user response:

I don't know what the exact problem was, but the solution was to go into the DB via SSMS, drop the offending table and then allow it to be recreated via deployment.

Oddly, in my first attempt I dropped the table and recreated it in SSMS and then did the deployment and it still failed with a warning about data loss.

  • Related