Getting your code into a version control repository is relatively easy. Doing the same for your database schema has historically been a bit trickier. I think this is partly because modern databases (like Microsoft SQL Server) come with quite useable graphical interfaces, which means that you can make many significant changes without ever writing a line of SQL.

The good thing though is that all of these changes are done using SQL, so version control is usually about keeping versions of the SQL scripts.

Some common techniques include:

  • One single production database and all changes are made live (be careful!)
  • Make changes to dev database and then migrate the changes to production (SQL Compare is great for this)
  • All schema objects are stored in scripts that need to be executed to create the database.

Creating the initial database isn’t too bad, but pushing out updates can be more difficult, especially if you need to deal with updating from different possible versions.

One tool that might prove in solving this problem is DBDeploy.NET - a port to .NET of the Java-based dbDeploy.