views:

992

answers:

3

I have this huge legacy database that I'm trying to get under source control. I looked around here on stackoverflow and decided to use the Visual Studio 2008 database project, then committing stuff on svn. I successfully imported the schema into the project, but I can't find any way to use the user-friendly table designers with this kind of project. Whenever I open a table, it opens the DDL definition. I need the designers, otherwise I won't get buy-in from the team. Any suggestions/workarounds?

A: 

Try opening the Server Explorer (View > Server Explorer). You may need to add a connection and then you can to the database tables, right click them and choose "Show table data".

0nce you're there you get the Query Designer toolbar and you're able to use the table designers.

sebastiaan
Any changes made there don't reflect on the project files. They are independent...
Mauricio Scheffer
A: 

I found sql server management studio (express free or the full product) easier to use than visual studio database projects. The one good thing i liked about vs was that you could select multiple objects (e.g. all tables) in the server explorer and generate a single script for them. These are not easy to maintain but are good for a quick back up of all objects. Management studio has the table and query designers and also allows execution plans and client statistic to be displayed so you can optimize queries/sps if required.

I have only used it with visual source safe for source control which works fine from Management Studio point of view, but vss is not great! (buggy, crashes, corrupts etc.)

Simmo
A single script wouldn't work, it would be very hard to find changes between two revisions
Mauricio Scheffer
@Mauricio not if it's in a decent source control system (TFS and SVN will both show you changes between checkins - I think even VSS does that), or if you have diff tool like BeyondCompare.
David Lively
+3  A: 

I'd use Microsoft® Visual Studio Team System 2008 Database Edition GDR. Which scripts every object in it's own file so makes it easy to track in version control.

For developers that don't want to use the tool let them develop in Management Studio and then use the Schema Compare tool in Database Edition to automatically extract out the changes from their development database into the project files when they are ready to check-in.

You may be able to write some (cunning) Visual Studio macros to do the Schema Compare automatically with the minimum of clicking for developers.

Craig
Like I said, the problem is that I can't use designers with Visual Studio's DB project (with or without GDR). Schema Compare is *way* too slow to be used for every commit.
Mauricio Scheffer
Ideally, I'd be able to create a DB project and then make any changes from there, using designers. Changes would be simultaneously written to the DB *and* the underlying version controlled script. Then I just commit the script.
Mauricio Scheffer
Thats not how I've seen it work in practice. What I've seen is what Craig suggested- developer makes changes to the database directly via Management Studio, then schema compare is used to pick up those changes before checkin. Not sure what you mean by using schema compare for every commit- again its only needed before checkin.
Frank Schwieterman
@frank: "commit" is the svn term for TFS's checkin. Schema compare is too slow for any non-trivial DB. Running a compare before every checkin/commit would severely slow us down.
Mauricio Scheffer