How to implement liquibase for multitenant postgresql database

Our PostgreSQL database is a single instance with several schemas sharing the same table structure, and I have three distinct environments: development, test, and production.
It is necessary to run the same changelog file in every environment and schema when using Liquibase.

There will be more than 100 schemas. I would like a report on the number of updated and non-updated schemas.

How can the changes made to all schemas be undone?

I tested a single schema Java application with Liquibase, and it functions perfectly. My changes in the changelog file were implemented into the schema.

How can I accomplish this with several schemas?

If a solution is available, kindly forward the URL.

Hi i have similar, I need to run the same (usually just dml) script for each tenant. I created schema for each tenant and under that have the databasechangelog table. All tenants get the same ddl, views, procs, functions and I run the liquibase upgrade for those with default databasechangelog schema… The database object has liquibaseCatalogName which is what you attach the tenant databasechangelog table schema too. I have java project that controls the process and reads the databasechangelog table per schema for the execution report.

Thanks for your reply.

  1. The DB Structure and meta data are same for all schemas​
  2. The DB Changes queries for both table structure change and meta data change are tracked with database version no ​in a common schema table
  3. For each schema in the database, a stored function is called to fetch the DB Changes queries from common schema table with version no greater than the current version no of the schema, execute it and update the latest database version no in the application control table of the schema.
  4. The schema wise DB Changes execution errors are logged in a common schema table
  5. Is this the correct approach?