1

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.

4

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

  • Thirty minutes later, and I finally find this solution. Frustrating! – SherlockSpreadsheets Jan 23 at 15:31
1

Visual Studio DB Projects seems to be a poor choice for managing db changes. There are so many different settings that must be set to get the desired effect like setting the "Drop objects in target but not in source". Also the post deploy scripts need to be set to no build action but the Scripts.Postdeployment1.sql needs to be set to PostDEploy build action.

If the project doesnt work properly its difficult to figure out what happened.

This is definitely not as transparent as normal T-SQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.