Cary Jensen gave a presentation at today’s CodeRage on versioning database metadata. In it, he showed a tool he had written which examines a database’s metadata, converts it into a series of structured text files, and uses a version control system to record differences since the last check it. The presentation will eventually be available for download here, although it’s not up at the time of this writing.
Cary’s tool was interesting to me since, some months ago, I had given serious thought to writing something almost identical. What stopped me? Lack of free time and Rails migrations.
Migrations take a completely different approach to versioning database method. With Cary’s tool, you implement your database metadata changes using your standard database editing tools, and run the tool after the fact to, in essence, describe the current state of the database to your version control system. With the migration, you describe the changes to your database metadata in Ruby source code. You deploy the changes to the database using a tool called rake, a Ruby-specific version of make, and you version control the changes in the same way that you would control any other source code.
Migrations have some advantages: They include code for both upgrading and downgrading the metadata of the database, and they can version data as well as metadata. On the other hand, the text files approach allows far easier differencing of, for example, stored procedure versions within your source control system.
I believe that there must be an approach which combines the advantages of both systems. That’s why I haven’t written anything yet, mostly.
One other thing: The new metadata features in dbExpress 4 might come in really handy for someone implementing migrations in Delphi.
{ 2 } Comments
I had a look at Rails and when I saw the post about the new metadata features in dbxexpress I noticed the similarity. I’m working on something that can be used from msbuild. I hope to stick it up on codecentral soon.
Sounds good, John!
Post a Comment