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

时间:2017-10-02 09:56:44

标签: relationship jhipster liquibase

我添加了两个现有表之间的关系,并使用函数“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$0(AsyncSpringLiquibase.java:64)
    at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(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 changelog吗?并更新校验和??

谢谢!

文斯

1 个答案:

答案 0 :(得分:0)

如果您尚未投入生产且无法保留数据,只需删除数据库并让您的应用重新创建数据。

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