1

Source Control for Databases

Posted on February 8th, 2006 /
Tags: ,

Josh Berkus asks a great question, what options are there for source control management (SCM) of databases? He focuses on three specific issues:

  • Database Diffs are DDL
  • Some Data Gets Copied, Some Doesn’t
  • A Database SCM Tool Should Control Source and Update the Database in One Action

I’d love to be able to get a SQL based diff for database schemas for different versions of an application. A tool like that would be a huge step by itself. So what does it take to tokenize SQL syntax? Perhaps CPAN’s SQL::Statement would good enough. It seems to understand a fair bit of SQL syntax. Additional work would have to be done get a set of ALTER TABLE commands to update the schema.

Such a tool will also fall prey to the issue support multiple databases. The two obvious targets to start with would be PostgreSQL and MySQL.

One Response to “Source Control for Databases”

  1. February 9th, 2006 at 7:07 pm Matt

    I talked to someone the other day who was doing diffs of DB dumps for unit tests, to see what the test touched in the DB.

Leave a Reply

Ads