Database Version Control - Introduction

20.09.2009 20:48Comments
Back in my post about structuring your source code, I recommended to have a “DB” folder where you can keep your database. This is actually one of my favorite topics of configuration management, and the reason for this is that I realized how many companies and projects don’t keep their database under version control.

DB folder content

The folders that will rest inside the “DB” depend on each of the different database versioning schemes. Nevertheless, I would recommend having a “common scripts” folder where you can store common tasks you usually perform in your database. Examples of the scripts I usually store there are: clean up scripts, testing users, and testing data/configuration.

Database versioning schemes

I have come across with three different ways of versioning a database:
  1. Store a backup of the database each time you modify something.
  2. Store “incremental changes” scripts.
  3. Use the Database project type shipped with Visual Studio Team Edition.
There is probably a forth option which would be to keep the database in xml files. This is more common when using certain ORM frameworks. Unfortunately I have never worked with such a scheme :s. Regardless of the scheme that suites you better, I strongly recommend to keep the database under version control. This is just the first of a series of posts I will be doing about Database Version Control, and the next posts will describe each of the schemes I have worked with.

comments powered by Disqus