Setting default schema working for XML refactorings, but not SQL

Hi-


I’m currently working on a web services application that embeds Liquibase. It will apply change logs to one of multiple PostgreSQL instances based on various input parameters.


When I create the connection to the desired database, I am setting the defaultSchemaName property on the Liquibase Database object.


The net affect is that the standard XML-based refactorings (e.g. ) are being applied to the specified schema. However, any refactorings are being applied to the “public” schema. This is with liquibase-core:2.0.3.


I have utilized Liquibase for both types of refactorings w/ Postgres in the past, just through the command-line interface. This is the first time I’ve attempted to embed. Interestingly enough, the code for the CLI looks exactly like the code that I’m writing in my application.


Is this a new bug/limitation of Liquibase (SQL refactorings cannot be run on a targeted schema)?


Thanks,


Matt

I think it is a limitation in how the tags work. With xml changes, there is a call to getDefaultSchema() to fill in the schema if it is not supplied when generating the SQL. For tags, however, they are taken directly as is.


With 2.0.4 (should be out tomorrow) you can use ${} changelog params in the data, so you could set a defaultSchema changelog parameter and use create table ${defaultSchema}.table_name in your blocks.


Nathan