JPA Buddy Liquibase Init Changelog

155 Views Asked by At

I want to use Liquibase (through JPA Buddy) for an existing Spring Boot project; I already have a database.

It is not clear to me what operation shall I perform first to register the current state of my database and work from now on using Liquibase (through JPA Buddy) for updating the tables.

If I generate a Liquibase Init Changelog using the database, I obtain a changelog than, when applied, produces exceptions (since I already have the tables in my database); a similar thing occurs when generating an Init Changelog using the model.

Should I then generate a Diff Changelog instead?

But what happens then when I deploy my Spring Boot app in a new environment, where the database does not exists: how can it create it w/o a baseline?

1

There are 1 best solutions below

0
On

I think in your case the most rational is to create the init changelog from the Database and mark it applied, in that topic you can find a few ways to do that. Then you can create Diff Changelog to eliminate the difference between the Database and your JPA model.