Applies to
- Liquibase Pro
- Liquibase Open Source (Community)
Conditions
- Any version of Liquibase Pro or Open Source
Question
Can you have multiple database connections in the liquibase.properties file?
Answer
No, the liquibase.properties
file itself is designed to support only a single target database connection at a time. Liquibase reads the liquibase.properties
file to load default settings, including details about the database connection (url
, username
, password
, etc.), but it cannot handle multiple connections directly within one properties file.
The reference database can be set for the diff and diff-changelog commands, but that reference database cannot have scripts deployed to it.
Alternative approach
While you cannot have multiple databases specified in a single liquibase.properties file, you can have multiple different properties files and use the defaults-file parameter to select a specific properties file to use.
For example:
liquibase --defaultsFile=liquibase-db1.properties update
liquibase --defaultsFile=liquibase-db2.properties update
Comments
0 comments
Article is closed for comments.