When working on a project with several other people it’s common to have several people with differente areas, such as the database.
My challenge is how to let several people edit the database model in a continuous integration environment.
A developer has suggested writing a “versioning script” where each edit was entered into a .sql script, with a version-number that the database would be able to detect. A new addition to the model would in this file be tagged with a version, and the database would be updated once the script had been submitted and a build had been run.
I’ve also heard about Publisher/Subscriber… and read a bit about it.
How do you manage this situation in your daily work, and what suggestions can you give me to make the database-changes run as seamless as possible ?
** Edit **
Migration frameworks and migration-scripts have been mentioned. If you have some practical experience and would suggest a framework, that would also be appreciated.
Quoting Jeff Atwood in the excellent Get Your Database Under Version Control post:
Really, the whole series is worth the read even if many of you seems to be specially interested by the 3rd part. And BTW, have a look at the Bulletproof Sql Change Scripts Using INFORMATION_SCHEMA Views article mentioned in the 3rd part too. You may already be aware of that but it explains amongst other good practices why writing idempotent change scripts is important.
Regarding tooling, you might want to check out UpToDater (code centric), LiquiBase (xml based) or… dbdeploy, a little gem based on real-world experiences of software development in ThoughtWorks. It’s not that the 2 first one are not good but this one is my preferred (and is available for Java, PHP or .NET).