I have one database with changelog. My application.conf:
slick.dbs.default.profile = “models.database.CustomPostgresProfile$”
slick.dbs.default.db.driver = “org.postgresql.Driver”
slick.dbs.default.db.url = “jdbc:postgresql://127.0.0.1:5432/mydb”
slick.dbs.default.db.user = “postgres”
slick.dbs.default.db.password = “postgres”
liquibase = ${slick.dbs.default.db}
liquibase.changelog = “classpath:liquibase/changelog-master.xml”
Then i add second database with different schema:
slick.dbs.db2.profile = “models.database.CustomPostgresProfile$”
slick.dbs.db2.db.driver = “org.postgresql.Driver”
slick.dbs.db2.db.url = “jdbc:postgresql://127.0.0.1:5432/mydb2”
slick.dbs.db2.db.user = “postgres”
slick.dbs.db2.db.password = “postgres”
How i can add changelog-master-db2.xml for second database? Or specify target database for changeSet in main changelog-master.xml.
I use: scala 2.12.6, play-slick 3.0.1, play-liquibase 1.4
On SO me say to use liquibase.properties file for define two database and two changelog files. How i can define it?
Hello,
It is suggest to make use of liquibase.properties file where you can mention the two database properties and the changelog file in one liquibase.properties file. You can find all the details about the liquibase.properties file on this page
Regards,
Ahmed.
Thank You. I read this page . But i not find information about two databases.
I need use double properties (driver, username, password, url, changeLogFile)?
changeLogFile: …liquibase/changelog-master.xml
driver: org.postgresql.Driver
url: jdbc:postgresql://127.0.0.1:5432/mydb
username: postgres
password: postgres
changeLogFile: …liquibase/changelog-master-db2.xml
driver: org.postgresql.Driver
url: jdbc:postgresql://127.0.0.1:5432/mydb2
username: postgres
password: postgres
Or I need use each property with two values separated by commas?
changeLogFile: …liquibase/changelog-master.xml, …liquibase/changelog-master-db2.xml
driver: org.postgresql.Driver, org.postgresql.Driver
url: jdbc:postgresql://127.0.0.1:5432/mydb, jdbc:postgresql://127.0.0.1:5432/mydb2
username: postgres, postgres
password: postgres, postgres
How to map a different changeLogFile for each database?
rakhi
June 10, 2021, 5:53am
4
For configuring two databases, you should have two properties file. Values seperated with comma would not work.
Or you can refer this SO post for an idea of how it is done in maven builds.
Thanks!
Rakhi Agrawal
Thank You! I don’t want to move the project to maven. Very many dependencies, customized deployment procedure, etc.