views:

192

answers:

6

First off the technical stuff:

We're using VS 2008 pro and running a MS SQL 2008 server. For sourcecontrol we use Subversion.

We'd really like to keep our stored procedures in subversion, so we can tell what was changed, when and so forth.

However in order for this to work, it has to be seamless, otherwise the developers are just going to forget getting the procedures included in their commits.

So are there any good solutions for this ?

I'm certain we can't be the only company with this issue :-)

+2  A: 

In our company, we use Team foundation server for Visual Studio team system to keep track of code sources and stored procedures versioning; stored procedures are handled just like any other source of code.

Database is not automagically syncronized to TFS; so, for every new SP you need to:

  1. Create it
  2. Add it to TFS
  3. Check in
  4. Add to Database

if you need to modify :

  1. Check out on TFS
  2. Modify source
  3. Check in on TFS
  4. Modify on Database

When we need to commit to production, we formally ask dba to synchronize the new/modified Stored Procedure to our production DB downloading and applying the latest version from TFS.

Possible problem scenario:

  1. Lazy developers (like me) modify SP directly on Sql server and don't align code on TFS
  2. Crazy developers (like me) forget to Checkin the latest fixed version and Dba align the bugged one in production
systempuntoout
Very nice elaboration :-)
Steffen
thanks Steffen, i hope no one of my company is watching this :)
systempuntoout
+5  A: 

In Visual Studio 2008, you can create a database project which will allow you to store all of your Stored Procedures and any other SQL statements within a nice project, which can then be housed in Subversion.

Ardman
Very nice - How I managed to never notice that project type I don't know. However a question: Can I somehow synchronize the project with my current database, or do I have to manually create every single Stored Procedure in VS ?
Steffen
If you have the database developer edition then yes :o) Think this link may help you: http://www.vitalygorn.com/blog/post/2008/01/Handling-Database-easily-with-Visual-Studio-2008.aspx
Ardman
Aw unfortunately we only have the "standard" pro version :-(But thanks for the link still :-)
Steffen
+1  A: 

If you are following an agile method, I suggest that you add "Dont forget to commit SPs" to your Done, Done definition so it becomes a natural part of your process.

Martin Wickman
Unfortunately we're not using agile, otherwise I totally agree :-)
Steffen
A: 

I'm very fond of Visual Studio Team Edition for Database Professionals which is now free to use if you have Visual Studio Team Edition for Developers. It will allow you to work with your database objects in an offline model which can be checked in to source control. The offline model is then used to automatically generate deploy scripts to the database.

The only downside is the price.

Anders Abel
I'm afraid the price will prohibit us from this approach :-(
Steffen
A: 

We have a program that makes any needed database versioning changes when program is installed/upgraded.

So in order for any SQL code being deployed, it must be included in that program (as resources in our case). This enables automatic versioning & adding of code to VS supported source control system.

See more in-depth description of our system behind the link.

Pasi Savolainen
Yes something homebrewed seems like the most viable solution, unless the company wants to pay for VS Team Edition.Unfortunately homebrewed apps takes time to develop :-(
Steffen
+2  A: 

I'm currently using a free tool called SQL Source Control from Red-Gate to do this and it works great, it plugs into SSMS. Here is a link with more info http://www.red-gate.com/products/SQL_Source_Control/index.htm I have to mention this is currently in beta but works great with SVN and TFS.

Eugene Niemand
I'll testdrive it tomorrow, it looks very promising :-)
Steffen
A lot of stuff happened last week so I haven't had the time to testdrive it yet. However I'm getting on to it right now :-)
Steffen
Gotta hand it to you - this tool is everything I dreamed of!It's so streamlined, and shows nice little icons if you need to commit something etc.Very very nice :-)
Steffen
Glad to be of help, just remember it is still beta, and will probably change to a paid for app when it reaches version 1.0. The only restriction with this at the moment is that you can only revert to last revision from the IDE which is not a huge problem. I'm sure you can revert further back if you go into the SVN repo, but haven't tried that.
Eugene Niemand
Well it's so good we'll just have to buy it when it reaches 1.0 :-)
Steffen
Glad you're liking the tool. You can either fetch the object from the repo and simply run it on your dev DB to update it. Or you can fetch a older schema from the repo and sync it to your DB using SQL Compare Pro. We plan to eventually embed this into the main tool.
David Atkinson
Just to let you know that SQL Source Control 1.0 has now been shipped. We've also initiated a project to integrate SQL Compare more closely. http://www.red-gate.com/products/SQL_Source_Control/index.htm
David Atkinson