June 28, 2009

Live SQL database schema updates

I previously wrote about managing live DB schema changes using protocols and context-oriented programming. About a month ago, I came across Jonathan Oxer's presentation about dealing with live schema changes to MySQL databases. The technique Oxer presents is a kind of obvious-in-hindsight thing that is beautiful in its simplicity: run update scripts and retry if an error (unknown table/column) in the query occurs.

Readers familiar with Geoff Wozniak's work will notice the similarity to his ideas about working with undefined functions (which, incidentally, was previously discussed on this blog in the context of using metaprogramming techniques to implement DB abstraction layers).

This is something I'm definitely going to try in my next SQL database based project.

No comments: