I am currently using Liquibase to create the database schema. It's a spring boot application that uses hibernate ORM.
Liquibase is changing the database schema at the beginning of application startup, before ORM is initialized (so that ORM looks at correct schema when being initialized).
However after the application is started I want to run Liquibase for the second time to populate data in the database with the help of the ORM and java code ( using java changeset: Java code changeset in liquibase ).
The reason to use Liquibase to populate the data with ORM and java is because Liquibase works correctly in a cluster (ex. if we have 3 nodes started at the same time only one node will populate the data).
Is is possible to run Liquibase in "2 phases"?
First time, during the application startup to update the database schema, and second time, after application was started, to populate some data using ORM. We need to do that from java code.
Previously when using Flyway we did that by having 2 Flyway instances, each with individual changes, and running the first instance at the beginning of the application startup before ORM is initialized and the second instance after the startup is complete and ORM is initialized.