# Working on multi-tenant database

**URL:** <https://forum.liquibase.org/t/working-on-multi-tenant-database/5055>\
**Category:** General Discussion\
**Created:** [February 11, 2021, 5:23pm UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055 "2021-02-11T17:23:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akshayware](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Akshayware](https://forum.liquibase.org/u/Akshayware)\
**Post date:** [February 11, 2021, 5:23pm UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055/1 "2021-02-11T17:23:22Z")

</div>

Greetings, I am working on oracle multi-tenant database (one database having multiple schemas). Let’s say I have 3 schemas A, B and C. currently I am creating 3 different changelogs for each of the schema (A.xml, B.xml, and C.xml) and also different properties files (A.prop, B.prop, and C.prop) In this way I am able to execute changelogs on the schemas. this approach however creates databasechangelog table on each of the schema. I was wondering if I could create one master schema M(having granted access to all A, B & C) having single master.xml and properties files ?? Really appreciate your answer, Thanks

---

<div class="post-metadata">

**Author:** ![Akshayware](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Akshayware](https://forum.liquibase.org/u/Akshayware)\
**Post date:** [February 11, 2021, 5:26pm UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055/2 "2021-02-11T17:26:29Z")

</div>

I read on the documentation that liquibase has schemaName attribute, but it is the attribute for createTable tag. Is there an attribute for a changeset where we can specify the schema name ?

---

<div class="post-metadata">

**Author:** ![costinmoraru](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@costinmoraru](https://forum.liquibase.org/u/costinmoraru)\
**Post date:** [February 11, 2021, 6:06pm UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055/3 "2021-02-11T18:06:03Z")

</div>

Hi @Akshayware,  
i suggest you to use 3 different liquibase properties file and point to the same changelog master.xml file if you want to apply the same update to all databases.

KR,  
Costin

---

<div class="post-metadata">

**Author:** ![ronak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ronak/32/221_2.png) [@ronak](https://forum.liquibase.org/u/ronak)\
**Post date:** [February 12, 2021, 3:23am UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055/4 "2021-02-12T03:23:15Z")

</div>

@Akshayware ,

@costinmoraru has a good suggestion for using the same changelog with multiple environments. I would also suggest if you want to set schema name dynamically (as in it may be different in different enviropnment) then you can use [property substitution](https://docsstage.liquibase.com/concepts/basic/changelog-property-substitution.html) for the schema name.

For example you can say:  
${schema.name}.tableName

---

<div class="post-metadata">

**Author:** ![Akshayware](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Akshayware](https://forum.liquibase.org/u/Akshayware)\
**Post date:** [February 12, 2021, 2:00pm UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055/5 "2021-02-12T14:00:06Z")

</div>

Thanks for your reply @ronak @costinmoraru. Really appreciate it. In my case, all the schemas have different changes in them so I use different master.xml for each of the schemas. Instead of spamming all the schemas with databaseChangelog table, I was wondering if I can use a single databaseChangelog table for all the schemas. I know that mentioning liquibaseSchema= we can mention the schema in which databaseChangelog table would be created. but will that work for multiple schemas (pointing to the same databasechangelog ) having different changes in each of the schema ? Thank You !

---

<div class="post-metadata">

**Author:** ![costinmoraru](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@costinmoraru](https://forum.liquibase.org/u/costinmoraru)\
**Post date:** [February 12, 2021, 3:13pm UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055/6 "2021-02-12T15:13:59Z")

</div>

Hi @Akshayware,  
A little confused on your question. the databasechangelog can track changes from diff changelog files (the rows contain a column for which changelog file it came from, so it won’t get confused between 2 changelog files).  
And of course, you are welcome, we want to help.

---

<div class="post-metadata">

**Author:** ![Akshayware](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Akshayware](https://forum.liquibase.org/u/Akshayware)\
**Post date:** [February 12, 2021, 4:46pm UTC](https://forum.liquibase.org/t/working-on-multi-tenant-database/5055/7 "2021-02-12T16:46:43Z")

</div>

Yes, this solves my question @costinmoraru. This will help me use liquibase for multiple schemas and having a single tracking table. Thank you.
