# how do i create same tables in different schemas using liquibase

**URL:** https://forum.liquibase.org/t/how-do-i-create-same-tables-in-different-schemas-using-liquibase/4869
**Category:** General Discussion
**Created:** [December 3, 2020, 3:09pm UTC](https://forum.liquibase.org/t/how-do-i-create-same-tables-in-different-schemas-using-liquibase/4869 "2020-12-03T15:09:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![gimazovbulat](https://avatars.discourse-cdn.com/v4/letter/g/54ee81/32.png) [@gimazovbulat](https://forum.liquibase.org/u/gimazovbulat)
#### Post date: [December 3, 2020, 3:09pm UTC](https://forum.liquibase.org/t/how-do-i-create-same-tables-in-different-schemas-using-liquibase/4869/1 "2020-12-03T15:09:03Z")

</div>

Imagine i had a table ‘some-table’ that i want to create in multiple schemas. File called ‘create-some-table.yaml’

```
 databaseChangeLog:
      - changeSet:
          id: create-some-table
          runOnChange: true
          author: gimazov (generated)
          preConditions:
            - onFail: MARK_RAN
              not:
                tableExists:
                  tableName: some-table
          changes:
            - createTable:
                columns:
                  - column:
                      autoIncrement: true
                      constraints:
                        nullable: false
                        primaryKey: true
                        primaryKeyName: some-table_pkey
                      name: id
                      type: BIGINT
                tableName: some-table
                schemaName: ${schema}

```

Then there’s a yaml file ‘schema1.yaml’ that includes the previous file and sets schema

```
 databaseChangeLog:
  - property:
      name: schema
      value: schema1
  - include:
      file: classpath:/db/changelog/create-some-table.yaml

```

Then the same file as the above one just named ‘schema2.yaml’ with corresponding schema name

The last thing is changelog-master which is pretty simple

```
databaseChangeLog:
    - include:
        file: classpath:/db/changelog/schema1.yaml
    - include:
        file: classpath:/db/changelog/schema2.yaml

```

Is there any way i can do something similar to this, thanks 🙂

---

<div class="post-metadata">

### Author: ![erinlkolp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/erinlkolp/32/237_2.png) [@erinlkolp](https://forum.liquibase.org/u/erinlkolp)
#### Post date: [December 15, 2020, 8:47pm UTC](https://forum.liquibase.org/t/how-do-i-create-same-tables-in-different-schemas-using-liquibase/4869/2 "2020-12-15T20:47:39Z")

</div>

We found it easiest to use Bash and iterate over multiple databases using a simple loop.

> <https://github.com/erinlkolp/liquibase-docker-demo/blob/main/jenkins-deployment.sh#L61>

We have lots of databases that all need the same schemas applied so it was quite simple to implement.
