I am trying out JHipster (version 6.4.1) using a Monolith and disk-based H2 database. I have created some entities in JDL and have the basic CRUD webpages working. Now that I feel comfortable with the process, I want to add fields and rename others. I figured I could simply update the JDL, re-import the JDL, start the application, and see the result of my changes. What I see is ValidationFailedException
from Liquibase and the application throwing HTTP 500 errors due to database problems.
I have looked all over for guidance on the proper process for handling this seemingly common development scenario. Most of the places I have looked for guidance (such as https://www.jhipster.tech/creating-an-entity) discuss importing JDL as a one-time-only operation and do not discuss how to incrementally change and import the JDL.
I have tried a number of suggestions as seen on SO, such as not overwriting the changelogs, doing a liquibase:diff
, and adding that to master.xml
. This still causes the ValidationFailedException
. In the master.xml
I see the comment <!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
which leads me to believe that JHipster should be doing the heavy lifting, but I am just missing a step.
I am by no means a JHipster nor a Liquibase expert, but I want to learn. How I can perform simple entity updates without a huge hassle?
[Update with more detail]
After re-importing the updated JDL, I have managed to get rid of the DB Validation Errors by blowing away the database with rm -rf target/h2db/db
.
I'm happy with my changes and feel like a commit is in order. What I see is
master.xml
is unchanged- the changelog from the first JDL import has been modified to include the updates I made
If I understand how liquibase works, I would have expected
- None of the existing changelogs would be touched
- A brand new changelog file would be created that contained just the JDL changes I made this round
master.xml
to have changed only in that it would contain an additional changelog entry, pointing to the file created in item 2
Am I misinterpreting how Liquibase represents evolution of the DB schema?