Hi,

Good overview of a very simple scheme. I like it :).

In my day job, we use a particular ORM a lot, which does the same kind of thing wrapped in a little DSL - and from it, I'd suggest the following:

First, especially for /big/ projects in a distributed VCS, use timestamps instead of sequential numbers. It really reduces the potential pain at the cost of looking slightly uglier.

Second, if you want to get a bit fancy, have a 'schema_versions' (or similarly named) table with a 'version' column. Every time you apply a patch, insert a new row into that table with the version ID/timestamp. This lets you have a stable deployment with migrations 1,2,3 and a staging one with 1,2,3,4,5,then backport a bugfix that relies on migration 5 but not 4 all by itself, then do a migration with 4,6,7,... when the time comes to upgrade stable by a major version.

It also lets you have 'up' and 'down' migrations - so you can apply and unapply each one individually if you want to - but I've never found that to be particularly useful. But then, I have a bad habit of doing data migrations at the same time as the schema migrations... ;)