Keeping a track of database changes

If you are anything like me you work as part of a small team managing databases, doing a bit of web development, handling calls for technical support, attending countless meetings and about a hundred other things. Its long been a constant concern of mine that there are changes being made to databases that I manage that will one day trip me up. Someone will add just one too many columns to a table, or even drop a table, and an application will stop working. When was the change made, who made it, why, was it tested before it was rolled into live? Unless you are blessed with clairvoyant powers or have a psychic friend, you would be best getting over to RedGate software.

The worries about this sort of thing are greatly eased now that RedGate have created SQL Source Control. It’s source control for your database, that you access from right inside Management Studio. It uses either Team Foundation Server (TFS) or Subversion (SVN) for the document store and your whole team can now update their own copies of a database and then merge changes safe in the knowledge that they have the most up to date, working schema in their hands.

The process could only be simpler if RedGate sent someone around to do it for you:

  1. Create or select a folder where the SVN repository is going to be stored
  2. Use TortoiseSVN to create a repository
  3. Select your candidate database in SSMS Object Explorer
  4. Link SQL Source Control to the repository folder

Done!

Any changes you now make in SSMS now get collected by SSC and you then get the ability to commit the changes to the repository at your convenience. If someone else in your team has made changes too then you can get the latest version from the repository and see if there are any conflicts and resolve them. The differences between different versions is also shown within SSMS so that you can see exactly what was changed.

Given that you make a series of changes to a dev database and commit these changes to the SSC repository and have run your tests to ensure its a workable set of updates you can then easily use SQL Compare to execute the scripts against your live server to move the changes into production.

RedGate have some videos of SSC in use and a few help files on their site here http://www.red-gate.com/products/sql_source_control/evaluation_center/index.htm and if you like what you see, you can grab a 28 day fully functional trial from the same place. RedGate’s SQL Toolbelt is a suite of applications for the busy DBA and they have added SSC to that suite, this means existing customers get it for free, for anyone new to SQL Toolbelt, well, you are getting even better value, at last count there are 14 applications included. I would heartily recommend it.