使用JHipster将新字段添加到现有实体 [英] Add new field to existing entity with JHipster
问题描述
当我尝试向现有实体添加新字段时遇到问题. 我运行此命令 yo jhipster:entity Libro和我选择[BETA]是,添加更多字段和关系,但是当我尝试使用./mvnw编译我的项目时,出现此错误 http://pastebin.com/SW1kpeDT
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
我也尝试遵循jhipster网站中的指南,但是我有相同的错误.
I also try to follow the guideline in jhipster site but I have the same error.
推荐答案
这是正常现象(至少在beta中是这样),因为更新操作更改了创建实体的Liquibase迁移文件20161022122700_added_entity_Libro.xml
,因此Liquibase会比较更新后的校验和文件,其中包含在更新之前首次运行迁移时在数据库中记录的校验和.
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.
因此,您有以下选择:
- 创建一个新的迁移文件,仅添加新列(请参见 addColumn文档),使用git将创建迁移恢复为其原始内容,运行您的应用以将更改应用于数据库.这就是您的应用在生产中时要执行的操作.
- 在数据库的
databasechangelog
表中手动清除校验和
对您的数据库 - 运行
mvn liquibase:clearCheckSums
命令.确保您的pom.xml
包含用于访问数据库的maven-liquibase-plugin的正确配置. - 在内存中将H2用作开发数据库
- 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 yourpom.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.
这篇关于使用JHipster将新字段添加到现有实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!