'Liquibase DatabaseChangeLogTable

There is a requirement in my project which requires more than one database change log table. Multiple microservices are connecting with one Db instance having logical segregation of tables. We want that when Microservice-1 is making changes to the database there should be a separate DatabaseChangeLogTable so that when MS-1 tries to rollback no other MSs updates are rolledback.

Can somebody suggests is there provision for this?



Solution 1:[1]

Since you want multiple microservices connect to the same database, you have to options:

  1. Use common databasechangelog table (it shouldn't be a problem if you write proper preConditions, since none of the changeSets will be executed if the preConditions are not met)
  2. use another name for databasechangelog table by specifying liquibase.databaseChangeLogTableName property.

For the first microservice you may set: liquibase.databaseChangeLogTableName=databasechangelog_microservice_1

For the second microservice you may set: liquibase.databaseChangeLogTableName=databasechangelog_microservice_2

etc.

Note:

for Spring-boot this property will have a name spring.liquibase.database-change-log-table=your_table_name

And in case you want to change the name of databasechangeloglock table, use this property: spring.liquibase.database-change-log-lock-table=your_lock_table_name

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 htshame