【问题标题】:jhipster add relationship between 2 existing tablesjhipster 添加2个现有表之间的关系
【发布时间】:2017-10-02 09:56:44
【问题描述】:

我在 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$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 更改日志吗?并更新校验和??

谢谢!

文斯

【问题讨论】:

    标签: relationship jhipster liquibase


    【解决方案1】:

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

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

    【讨论】:

    • 好的,我可以删除数据库,但在生产中?我该怎么做?
    • 在我的第二种选择中你不明白什么?
    • 我以为 jhipster 会自动处理它
    • 这是一项复杂的任务,有人正在做 PR 以改进事情,尽管它还没有准备好并且可能无法涵盖您的特定用例。见github.com/jhipster/generator-jhipster/pull/6016
    猜你喜欢
    • 2017-07-08
    • 2019-12-17
    • 2018-06-17
    • 2019-09-04
    • 1970-01-01
    • 2021-10-31
    • 2014-01-15
    • 2018-06-08
    • 1970-01-01
    相关资源
    最近更新 更多