I have an application in PHP/MySQL. I am searching for an automated way upgrading database behind the application.
I don’t need to have the compatibility with older versions once it is upgraded.
I have read jeff’s and K. Scott Allen’s articles on this.
I am still not sure how to implement this for a PHP/MySQL application.
Is there any simple and good process for this?
I have a “Schema” object that I use – but you could do the same without classes..
What you want to do is create a ‘
db_schema_versions‘ table:After your database can track what version # it is on – it can do SQL upgrades automatically.
You should lock your schema table while upgrading schema. This way you wont have two requests at the same moment trying to upgrade your schema.
So – keep track of the version you are upgrading from – build a big switch – something like this: