You just have to love Red Gate tools. They find the small area that they want to cover and then they cover it extremely well. I rave regularly about SQL Prompt and SQL Compare and SQL Search (free one, btw). I’ve got SQL Data Compare and SQL Data Generator open & working on my desk regularly. I’m dabbling in their other tools fairly often as well. I just like Red Gate tools. I guess my constant & consistent praise is why I’m a “Friend of Red Gate.” I like to mention that before I start praising their tools some more, just so no one thinks I’m hiding it. Why would I hide it? I’m proud to say it. I am a Friend of Red Gate! … anyway… where was I… right, new software. I took a small part (a very small part) in the beta for their new software, SQL Source Control. I thought it was pretty cool when it wasn’t quite working right. Well, now it’s out, working very well, and it’s pretty slick.
Basically Red Gate has created a nice tight coupling between Source Control & your database. They currently support Apache Subversion and Microsoft’s Team Foundation Server (TFS). It let’s you create a mechanism for keeping track of your databases in the same way that you track your code. I honestly believe this is a must for any reasonably sized development team (read, more than two). I can expound on why, but instead I’ll just talk some more about SQL Source Control.
First thing you need to know is that it’s hooked into Management Studio. After you do the install, you get some extra windows in SSMS that look something like this:
I’ve scratched out my own server & database names, but you get the idea. The description summarizes it very well. Lots of people can work on the database, save the scripts into source control, and then they can pull that common set of scripts back out to do more work, just like working with code. It really is the best way to develop.
You just have to connect up the database following the directions and you’ll see something like this:
If you can see that, that’s a database (name hidden) that’s been hooked up to source control. Actually, that and the change to the set-up screen are about your only indications that this tool is running. I love the lack of intrusion.
Better still, each time you reconnect the database, as it goes and checks to see if there are updates in source control, you get a little spinning… looks like a yin/yang symbol.
Enough about pretty graphics. How does it work? Extremely well. I started adding new database objects, editing existing objects, and all it ever did was put one of it’s little symbols on the object that I had created or edited, marking it as a change. When I was ready to move the changes to source control, I just clicked on the Commit Changes tab. All the changes are listed and you see scripts showing before & after between the code in the database and the code in source control.
It just works. Same thing going the other way. A database already connected can just pull changes out and apply them. Nothing I did in all my testing hit a snag (granted, I was just working on pretty traditional tables, procedures, indexes, etc.).
The one thing I’ve found that I don’t like is that there doesn’t seem to be a facility for deploying the databases automatically. Instead, I had to create a blank database, hook that to the existing database in TFS and then pull down all the “missing” objects. Hopefully they’ll go to work on a way to automate that soon.
Just to reiterate, the point of the exercise is to get your code (and while you’re developing, a database is as much code as anything written in C#) into source control. Once you’re in source control, you manage your databases just like code, label, version, branch, whatever you need to do to maintain a tight coupling with the rest of the code for the app. SQL Source Control acts as a very fast and simple tool to enable that coupling for you.
[…] URL: Red Gate SQL Source Control « Home of the Scary DBA Tags: compare, desk, desk-regularly-, free-one, generator, often-as-well, other, prompt, […]
Thanks for that review – yesterday somebody asked me if we could test this out. The answer is no for now – we have no space on the TFS server…
I have two questions if you don’t mind answering them: do you have to buy a license for every developer or do you buy the server and get unlimited client copies?
and why didn’t this exist before 🙂
Looks like it’s a per user license: http://www.red-gate.com/Dynamic/ShoppingCart/QuoteProductOption.aspx?Product=sqlsourcecontrol
Thank-you
I haven’t found a way to view the history of the file. I can only see the latest and greatest version of the file in source control, and when I browse via TFS source control I don’t even see the files in there. Am I missing something or is that true for you as well?
You can’t do this from SSMS yet. If you explore the TFS repository using TFS’s Souce Control Explorer using the repository details (in the setup tab) you will be able to view the history of the object files just as you would any other sourced controlled file in TFS.
We have future plans to bring this into SSMS but for now there’s a simple workaround that people are already familiar with.
David beat me to it, but I’ll go ahead and report in.
Yes, I can see the files in TFS and they have history. There isn’t any way to see that from Management Studio. And, because I’m looking through here in detail for the first time (I really let you guys down on the beta), I just saw the folder for “Data.” Hmmmm… wonder how that works. More stuff to work with and learn from.
Ahh yes, I see it now through source control explorer. I can’t see it through project explorer though, does that sound right to you guys?
Nice tool, looking forward to seeing history in SSMS.
Dylan – The project explorer in VS only lets you view the contents of a VS Project, so it’s the right place to look. Use the Source Control explorer in the meantime. We’re keen to get everything much more integrated in future versions.
scarydba – You can compare and synchronize static data tables to and from the data folder using SQL Data Compare Pro. In future versions this will be tied into the SQL Source Conrol UI in SSMS, so the workflow will be improved.
David, Thanks. More to explore. And you can call me Grant.