views:

94

answers:

1

Directly related to http://stackoverflow.com/questions/2768489/visual-studio-2010-database-project-is-there-a-visual-way/2772205#2772205

I have a problem synchronizing between database project and a database in Visual Studio.

Usually I synchronize FROM database TO database project (using the Visual Studio > data > scheme compare > new schema comparison).

The synchronization works, BUT when I for example corrected the spelling of a key in the database and synchronized it - the file with the WRONG spelling of a key remains (albeit is commented out inside). the new one is correctly added.

This file happens to be in:

[project name]/Scheme Objects/Schemas/dbo/Tables/Keys

But for sure there are others elsewhere.

how to automatically remove such obsolete files when synchronizing?

thnx

A: 

You could write a small console application (or a script) that looks at all files in your project and remove the ones that contain only commented sql statements.

There is one thing to consider though: If you re-name an object you might want to tell your source control system that you re-named the object i.e. you would not just delete the old file. This way you would preserve the history of the object (I think with Git this would not be an issue but it is for others).

Usually I pull the changes from the database into my project very frequently and thus I only have couple of files that change. This way it is not too hard to manually delete obsolete files or make my source control system believe that I renamed a file.

Stefan Egli
true. was just wondering if there is some configuration or setting to change so this is done automatically :P
b0x0rz

related questions