How decently track the database structure modification by SVN? How decently track the database structure modification by SVN? database database

How decently track the database structure modification by SVN?


Take a look at LiquiBase (http://www.liquibase.org/)

It's a tool designed for allowing developers to commit database changes to SVN, and then apply them safely and automatically to the database.

Changes can either be reverse engineered by comparing two databases, or hand coded by the developer and committed.

It also ensures that database changes are applied in the correct order, and only applied once to a given database.


We simply version the scripts used to create the database from scratch. The developers edit the scripts in the text files, and not in the database. Developers do not have access to the production SQL servers, and the DBA team uses tools specifically designed to compare database schemas (in our case, Red-Gate SQLCompare) in order to do production builds. They'll create a new, empty database from the scripts, and use the compare tool to detect changes. Some changes can be automatically applied, and some must be hand-altered.

It's not a perfect system, but it's worked fairly well for us so far.


I wouldn't use MySQL dumps because they are mostly used for data backup, and you usually don't use version control to manage data backups. Instead, I would just version control the install script or the SQL file used to set up the initial database structure.

For small projects, I usually just have a file called install.sql which contains all of my CREATE statements and schema.txt which describes the schema. For larger projects, you might want to use something like dbForge, which allows for database schema versioning in the professional edition, though it's a bit pricey if that's all you're using it for.

Check out this article on Coding Horror (especially the first link in that post) for more guidance.