As the application I’m developing is expanding across multiple sites, each with its own database, I’m having a few issues with database migration. What I’d like to do is to automate the process as much as possible. As I’m sure we all know the main issue with updating manually is that sometimes things get missed.
As such, I was thinking about making the system check for new migrations on page load, and executing these if found. There would be safeguards against the updates being performed multiple times, with the system displaying a simple maintenance message if an update is in progress, and the database upgrades would be tracked using a system similar to that mentioned in this post.
I’ve got unit testing running with Jenkins now, my plan is to sync my test database to a copy of the live database at the start of the job, which over the course of the tests will obviously entail running any migrations.
My question is basically, is this a good idea? Can anyone think of a better way?
Thanks, I just took another look at my setup and face-palmed as I realised that I already have a script that I run when I publish a new version of the code. I should be able to put the yiic command in there. Yes?