How to specify the default schema name within a changelog?

I just started experimenting with Liquibase and ran into a roadblock which made me question whether I’m approaching the problem correctly. Any advice is welcome. This is my situation:

I have an application that uses multiple mysql databases. I thought it would be a good idea to create a master app.xml file that runs one changelog for each database:


   
   
   


This way all databases for this app are updated in a single update command. I hoped generateChangeLog would include some sort of schema identifier in the generated changelogs, but it does not, meaning that all of the changesets would be applied to the same database. I tried using the outputDefaultSchema option but it made no difference. I know I could add a “schemaName” attribute to each change, but that feels like it’s going to be very susceptible to mistakes (someone is going to forget to add the attribute eventually). Is there a way to set the default schema within each individual changelog?

There isn’t a way to specify it for each changelog. Just the global defaultSchemaName that applies to all changeSets that don’t have a schema specified. 


The best approach may be to have a separate changelog for each schema and run liquibase once for each schema passing along a different connection URL or defaultSchemaName for each run.


The only other approach is to specify the schemaName attribute for all the non-“default” schema objects which definitely can be error prone.


Nathan