Similar to gnarf's suggestion I would run with the following:
- For every change to the schema create an SQL file that when run will take you from the old version to the new version (this could be one file per major version or lots of smaller changes).
- Create a separate file listing each of the SQL file names in the order they must be applied in (oldest at the top, newest at the bottom)
- Create a simple "versioning" table (all it needs is a single VARCHAR column) in your database
Now you need to write a simple script that works in the following way:
- Query the versioning table for the name of the last SQL update file applied
- If there are newer SQL alteration files to be run execute them in sequence
- record the name of the newest SQL file applied
I hope that makes sense