Is there a way to specify the schema where liquibase creates the database changelog tables (databasechangelog and databasechangeloglock)?
I'm using postgresql and gradle. I defined a schema for my application (e.g. myapplication).
When I run the liquibase update task from gradle, the application specific tables are correctly created inside the 'myapplication' schema, but the liquibase changelog stuff is created in the 'public' schema.
Not covered in the documentation, but available in current versions of Liquibase (I'm not sure how far back that applies) are the command line arguments
--liquibaseCatalogName
and
--liquibaseSchemaName
Using these will allow you to keep your "managed schema" and your "liquibase schema" separate.
For gradle, I think you would specify these in you configuration block:
liquibase {
activities {
main {
changeLogFile 'changelog.groovy'
url 'jdbc:h2:db/liquibase_workshop;FILE_LOCK=NO'
username 'sa'
password ''
changeLogParameters([ myToken: 'myvalue',
second: 'secondValue'])
liquibaseSchemaName 'myLiquibaseSchema'
defaultSchemaName 'myApplicationSchema'
}
second {
changeLogFile 'second.groovy'
url 'jdbc:h2:db/liquibase_workshop;FILE_LOCK=NO'
username 'sa'
password ''
changeLogParameters([ myToken: 'myvalue',
second: 'secondValue'])
}
}
// runList = project.ext.runList
// runList = 'main'
runList = 'main, second'
}
If you are using a properties file, the properties you set are the same names as the command line options, so you would have something like this:
liquibaseSchemaName=myLiquibaseSchema
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With