After regenerating an entity, I get this error :
change sets check sum
config/liquibase/changelog/20180403061345_added_entity_SpyEvent.xml::20180403061345-1::jhipster was: 7:66f49af3dc2a8a590be256531a90feef but is now: 7:0338777b2908da772f5167c024316c10
liquibase.exception.ValidationFailedException: Validation Failed:
1 change sets check sum
config/liquibase/changelog/20180403061345_added_entity_SpyEvent.xml::20180403061345-1::jhipster was: 7:66f49af3dc2a8a590be256531a90feef but is now: 7:0338777b2908da772f5167c024316c10
at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:266)
##### **Related issues**
https://github.com/jhipster/generator-jhipster/issues/6176
##### **JHipster configuration**
`##### **JHipster Version(s)**
[email protected] E:\RealmSpySandbox
`-- [email protected]
##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.realmspy.sandbox"
},
"jhipsterVersion": "4.14.1",
"baseName": "RealmSpySandbox",
"packageName": "com.realmspy.sandbox",
"packageFolder": "com/realmspy/sandbox",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "no",
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"enableSwaggerCodegen": false,
"jwtSecretKey": "replaced-by-jhipster-info",
"clientFramework": "angularX",
"useSass": true,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": false,
"enableHibernateCache": false
}
}
entityName.json files generated in the .jhipster directory
JDL entity definitions
entity SpyEvent (spy_event) {
server Server required,
map String,
intCondition Integer
}
enum Server {
USEast2,
USEast,
USSouthWest,
AsiaSouthEast,
USWest,
USNorthWest
}
relationship ManyToOne {
SpyEvent{user required} to User
}
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
git version 2.16.1.windows.1
node: v8.9.4
npm: 5.6.0
gulp:
[14:59:21] CLI version 2.0.1
yeoman: 2.0.1
yarn: 1.5.1
Docker version 18.03.0-ce, build 0520e24
docker-compose version 1.20.1, build 5d8c71b2
`
entityName.json files generated in the .jhipster directory`{
"fluentMethods": true,
"relationships": [
{
"relationshipName": "user",
"otherEntityName": "user",
"relationshipType": "many-to-one",
"relationshipValidateRules": [],
"otherEntityField": "id"
}
],
"fields": [
{
"fieldName": "server",
"fieldType": "Server",
"fieldValues": "USEast2, USEast, USSouthWest, AsiaSouthEast, USWest, USNorthWest",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "map",
"fieldType": "String",
"fieldValidateRules": []
},
{
"fieldName": "intCondition",
"fieldType": "Integer",
"fieldValidateRules": []
}
],
"changelogDate": "20180403061345",
"dto": "no",
"service": "no",
"entityTableName": "spy_event",
"jpaMetamodelFiltering": false,
"pagination": "no"
}
`
liquibase:clearCheckSums
does not seem to work with JHipster
Yes if you re-generate an entity that's "normal", let me explain. Considering you modified something in your entity, of course (otherwise it doesn't make any sense):
jhispter entity Foo this is going to regenerate your Liquibase changelog. So it won't work on an existing database, unless you drop it of course. So it's easier, but this would mostly be used in development.So it depends on your context: if you are in development you can drop your data and code quickly, and if you are in production you can't drop your data and you will have a bit more work.
Hi,
@jdubois when you said "You will have more things to code" in the second solution, what's mean?
I must code what?and where?
thanks
You will need to migrate your database schema, and more importantly your data, all by hand.
That's a complex and error-prone task.
Also, if you work in a team you will need to tell your coworkers to update their database manually when they pull your new code.
For all this, I feel it's easier to use Liquibase than doing stuff by hand, but then JHipster is just here to help by pushing a solution, and it's made to be disabled easily.
Thank you for your response;
I forgot to mention that I use this commande
jhipster import-jdl dataBase.jdl
to add a field.
So all data are correctly and automatically generated.
and after that i generated a changelog with mvnw liquibase:diff .
it's for that I don't see what i must do more ( i update my database(mysql))
When you update your entities, whatever the mean(by updating your jdl file or using the entity sub-generator directly), make sure to choose not to override your existing changelog files: as this will cause liquibase to fail as described.
Then, to inform liquibase what changes it needs to apply to your database , generate a changelog file resuming the changes you just did by using mvnw liquibase:diff . Rename that file as to remind you or your team your changes, add it to the master.xml file and re-run your app.
Everything should be OK.
Hope it helps someone.
Most helpful comment
When you update your entities, whatever the mean(by updating your jdl file or using the entity sub-generator directly), make sure to choose not to override your existing changelog files: as this will cause liquibase to fail as described.
Then, to inform liquibase what changes it needs to apply to your database , generate a changelog file resuming the changes you just did by using
mvnw liquibase:diff. Rename that file as to remind you or your team your changes, add it to themaster.xmlfile and re-run your app.Everything should be OK.
Hope it helps someone.