Changelogs with multiple databases

I’m trying to figure out the best practice for my use case.


Let’s say I have multiple MySQL databases and one changelog. I don’t want all the changesets in the changelog to be applied to every database. Instead, I want specific changesets to be applied to specific databases, but with one master changelog instead of having a changelog for every database.


I think I can do this by using


  1.    
  2.        
  3.             select database()
  4.        
  5.        
  6.    
  7.    
  8.        
  9.             select database()
  10.        
  11.        
  12.    

But is this against best practice? Basically, is it best practice to have one master changelog per database schema, or is it okay to combine changes for multiple schemas into one master changelog and select which changes to apply using sqlCheck?

Hello; it looks like you can do this if you know you’re running on MySQL.  I personally wouldn’t (I’d prefer multiple changelogs, but that’s probably more personal preference than anything else).  Instead of dozens of preConditions blocks and repeated boilerplate, I’d just do one database per changelog.


Best,

Laird



http://about.me/lairdnelson

Any ideas?