jhipster 添加 2 个现有表之间的关系

jhipster add relationship between 2 existing tables

我添加了 2 个现有表之间的关系,并使用函数 "jhipster import-jdl" 重新生成,但是当我启动应用程序时,liquibase 出现错误:

2017-10-02 11:45:02.968 ERROR 9036 --- [idia-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase   : Liquibase could not start correctly, your database is NOT ready: Validation Failed:
 2 change sets check sum
      config/liquibase/changelog/20171002091222_added_entity_Utilisateur.xml::20171002091222-1::jhipster was: 7:716203e07c10f181f65dd9531b803796 but is now: 7:5bad37468d044f75f42287e794d6dd97
      config/liquibase/changelog/20171002091222_added_entity_constraints_Utilisateur.xml::20171002091222-2::jhipster was: 7:b56406e6f7f1206accc2de82f799bd40 but is now: 7:1123b5400c7cbbb680fc9a10c7278ca0


liquibase.exception.ValidationFailedException: Validation Failed:
 2 change sets check sum
      config/liquibase/changelog/20171002091222_added_entity_Utilisateur.xml::20171002091222-1::jhipster was: 7:716203e07c10f181f65dd9531b803796 but is now: 7:5bad37468d044f75f42287e794d6dd97
      config/liquibase/changelog/20171002091222_added_entity_constraints_Utilisateur.xml::20171002091222-2::jhipster was: 7:b56406e6f7f1206accc2de82f799bd40 but is now: 7:1123b5400c7cbbb680fc9a10c7278ca0

    at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:266)
    at liquibase.Liquibase.update(Liquibase.java:210)
    at liquibase.Liquibase.update(Liquibase.java:192)
    at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:431)
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:388)
    at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:82)
    at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet[=10=](AsyncSpringLiquibase.java:64)
    at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable(ExceptionHandlingAsyncTaskExecutor.java:66)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

我需要做什么才能在现有表上添加关系?

我必须手动为 liquibase 添加 xml 变更日志吗?并更新校验和??

谢谢!

文斯

如果您不在生产环境中并且没有要保留的数据,只需删除您的数据库并让您的应用程序重新创建它。

否则,请手动创建新迁移或使用 liquibase diff 添加关系。迁移应该是不可变的,这就是 Liquibase 校验它们的原因,当你想向过去的结构中添加一些东西时,你应该添加新的迁移而不是修改旧的。