Dennis A. Boanini
Dennis A. Boanini

Reputation: 497

Add new field to existing entity with JHipster

I've a problem when I try to add a new field to an existing entity. I run this command yo jhipster:entity Libro and I choose [BETA] Yes, add more fields and relationships, but when I try to compile my project with ./mvnw I receive this error http://pastebin.com/SW1kpeDT

I also try to follow the guideline in jhipster site but I have the same error.

Upvotes: 4

Views: 4240

Answers (1)

Gaël Marziou
Gaël Marziou

Reputation: 16284

It's normal (at least in beta) because the update operation changed the Liquibase migration file 20161022122700_added_entity_Libro.xml that created the entity, so Liquibase compares the checksum of the updated file with the checksum that was recorded in your database when migration was first run before update.

So you have these alternatives:

  • create a new migration file to add only the new column (see addColumn documentation), revert the creation migration to its original content using git, run your app to apply changes to your database. This is what you would do when your app is in production.
  • clear the checksums by hand in databasechangelog table of your database(s)
  • run mvn liquibase:clearCheckSums command against your database(s). Make sure your pom.xml includes correct configuration for maven-liquibase-plugin to access your db.
  • use H2 in memory as dev database

As this feature is beta, this issue is probably going to be addressed.

EDIT 2022: since JHipster 7.0, there is the --incremental-changelog option that solves this.

Upvotes: 4

Related Questions