Column drop in dacpac

20 Views Asked by At

I need to drop a column from existing table. For that I added drop column script in predeployment script and removed that column from the table in the project. But dacpac is throwing an error:

Alter table drop column failed because column xxx does not exists in the table

Understood the reason but don't know how to resolve it.

I want to drop the column and also remove from DB project in the same dacpac version that's because we have multiple clients creating several dacpacs will cause confusion.

And also client doesn't want to use BlockOnPossibleDataLoss=false.

1

There are 1 best solutions below

0
Dmitrij Kultasev On

I doubt you can drop the column with having BlockOnPossibleDataLoss=true. I guess that you can one of the following methods:

  • Drop the column in pre-deployment script without removing it from the model, then remove it from the model after deployment was made
  • You can pass BlockOnPossibleDataLoss=false when deploying. I assume it should override the values you have in publish profile. I haven't tested it.