Visual studio database project – publish did not include drops but schema compare did

azure-sql-databasevisual studio

I just observed a difference in the result of publish vs schema compare. I made changes to visual studio database project – some of which involved deleting tables.

  1. Pushed changes to VSTS, build successful, release successful to Azure DB
  2. Inspected said Azure DB. Tables were not dropped that were deleted in the project. Double checked the publish script – this didn't include any of the drops.
  3. Ran SchemaCompare – this exposed all of the missing drops, and when executed gave me the result I expected (the applicable tables were dropped).

The same results were observed on local DB when manually publishing vs schema compare. What am I doing incorrectly? I thought publish would drop the tables.

Best Answer

Publish>Advanced Settings>Drop>"Drop objects in target but not in source"

https://stackoverflow.com/questions/1799802/dropping-a-table-with-visual-studio-2010-database-project