# How do i manage multiple databases with Liquibase?

**URL:** <https://forum.liquibase.org/t/how-do-i-manage-multiple-databases-with-liquibase/10683>\
**Category:** General Discussion\
**Created:** [October 10, 2025, 3:00am UTC](https://forum.liquibase.org/t/how-do-i-manage-multiple-databases-with-liquibase/10683 "2025-10-10T03:00:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerry118118](https://avatars.discourse-cdn.com/v4/letter/j/9fc348/32.png) [@jerry118118](https://forum.liquibase.org/u/jerry118118)\
**Post date:** [October 10, 2025, 3:00am UTC](https://forum.liquibase.org/t/how-do-i-manage-multiple-databases-with-liquibase/10683/1 "2025-10-10T03:00:48Z")

</div>

Hello, I want to manage multiple databases in one of my PostgreSQL using Liquibase.

I have already setup a dedicated SQL repository for this purpose, but I am struggling on the changelog structure. I try to follow the guide in [Managing Multiple Schemas with Liquibase](https://www.liquibase.com/blog/handling-multiple-schemas-with-liquibase), where I think both of it does not work.

1.Create a root changelog in each database folder.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/liquibase1/original/2X/1/110d19551f58081b4dee189ce24ba2673bcc61df.png)

With this approach, it becomes trouble as I cannot use includeAll in my root changelog to simply include the whole database folder, which will result in circular error. It still works if I just use include, but then I have to update root changelog everytime when I have a new version of changelog.

2.Create a master changelog outside the database folder. Create a root changelog in each database folder.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/liquibase1/original/2X/7/792dc4b5a4b0f806c43695b408e6aae63ed4b107.png)  
Following the example, I assume I will include all the child root changelog in my master changelog.

```auto
<include file="schemaA/changelog.xml" context="schemaA"/>
<include file="schemaB/changelog.xml" context="schemaB"/> 
<include file="schemaC/changelog.xml" context="schemaC"/>

```

But the master changelog is totally useless as I cannot use it during liquibase update which is called per database `--url=jdbc:postgresql://{db_hostname}/{db_name}`. If I use the liquibase update using the master changelog, then it will apply other database changelog to the incorrect database.

Please suggest any changelog structure for managing multiple database, thanks.

---

<div class="post-metadata">

**Author:** ![Pete](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/pete/32/184_2.png) [@Pete](https://forum.liquibase.org/u/Pete)\
**Post date:** [October 31, 2025, 2:33pm UTC](https://forum.liquibase.org/t/how-do-i-manage-multiple-databases-with-liquibase/10683/2 "2025-10-31T14:33:33Z")

</div>

I think the structure in your changelog is fine. JDBC and Postgresql connections are indeed tricky. I’ve seen users with a similar use case setup the changelogs like this and then created a script or use something like maven to run multiple `liquibase update` operations.

You might also be able to use `USE database_name;` commands in your .sql files, but I haven’t tried that out before.
