What is the preferred way to update database schemas in multiple production environments

Posted by rmarimon on Stack Overflow See other posts from Stack Overflow or by rmarimon
Published on 2010-04-15T13:11:11Z Indexed on 2010/04/15 13:13 UTC
Read the original article Hit count: 265

Filed under:
|
|
|

I am about to install some 20 servers with the same web application in multiple locations connected to their own local database. I will be updating the web applications remotely (perhaps using debian's package manager) and I'm sure will eventually need to update the database schemas. Since each server could be eventually be using a different release of the web application, I need a way to apply the incremental changes to the servers.

I'm thinking something like this. Let's start with database.schema.1 as the original release of the database and assume this number increases with each new version of the schema. I eventually could end up with database.schema.17 as the current release. For a new installation this would be the schema to install. It seems to me that I would need consecutive translations like database.translation.1.2 which would convert database.schema.1 into database.schema.2, database.translation.2.3 to convert from 2 to 3 and so on until 17. It seems that whenever I change a schema I need to alter the database but perhaps I need to run some script to update the data which might be done with SQL but might require an external non sql script.

What is the appropriate way to organize all these files? What is the automatic way to apply those upgrades to the schema? Where do I store the current version number of the schema?

© Stack Overflow or respective owner

Related posts about database

Related posts about schema