# How use liquibase with play framework for two databases?

**URL:** <https://forum.liquibase.org/t/how-use-liquibase-with-play-framework-for-two-databases/5572>\
**Category:** General Discussion\
**Created:** [June 9, 2021, 12:15pm UTC](https://forum.liquibase.org/t/how-use-liquibase-with-play-framework-for-two-databases/5572 "2021-06-09T12:15:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tempelfeld](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Tempelfeld](https://forum.liquibase.org/u/Tempelfeld)\
**Post date:** [June 9, 2021, 12:15pm UTC](https://forum.liquibase.org/t/how-use-liquibase-with-play-framework-for-two-databases/5572/1 "2021-06-09T12:15:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ahmedabdeljelil](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ahmedabdeljelil/32/397_2.png) [@ahmedabdeljelil](https://forum.liquibase.org/u/ahmedabdeljelil)\
**Post date:** [June 9, 2021, 1:39pm UTC](https://forum.liquibase.org/t/how-use-liquibase-with-play-framework-for-two-databases/5572/2 "2021-06-09T13:39:24Z")

</div>

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](https://docs.liquibase.com/workflows/liquibase-community/creating-config-properties.html)

Regards,  
Ahmed.

---

<div class="post-metadata">

**Author:** ![Tempelfeld](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Tempelfeld](https://forum.liquibase.org/u/Tempelfeld)\
**Post date:** [June 9, 2021, 2:06pm UTC](https://forum.liquibase.org/t/how-use-liquibase-with-play-framework-for-two-databases/5572/3 "2021-06-09T14:06:24Z")

</div>

Thank You. I read [this page](https://docs.liquibase.com/workflows/liquibase-community/creating-config-properties.html). 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?

---

<div class="post-metadata">

**Author:** ![rakhi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/rakhi/32/288_2.png) [@rakhi](https://forum.liquibase.org/u/rakhi)\
**Post date:** [June 10, 2021, 5:53am UTC](https://forum.liquibase.org/t/how-use-liquibase-with-play-framework-for-two-databases/5572/4 "2021-06-10T05:53:51Z")

</div>

For configuring two databases, you should have two properties file. Values seperated with comma would not work.

Or you can refer [this SO post](https://stackoverflow.com/questions/22355725/loading-data-from-properties-file-to-be-used-by-liquibase-in-maven-build) for an idea of how it is done in maven builds.

Thanks!  
Rakhi Agrawal

---

<div class="post-metadata">

**Author:** ![Tempelfeld](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Tempelfeld](https://forum.liquibase.org/u/Tempelfeld)\
**Post date:** [June 10, 2021, 9:25pm UTC](https://forum.liquibase.org/t/how-use-liquibase-with-play-framework-for-two-databases/5572/5 "2021-06-10T21:25:00Z")

</div>

Thank You! I don’t want to move the project to maven. Very many dependencies, customized deployment procedure, etc.
