如何在使用Envers时处理Flyway迁移?

huangapple go评论62阅读模式
英文:

How to approach Flyway migration when using Envers?

问题

我需要向我的数据库添加一些数据。简单的INSERT语句。我会在Flyway迁移SQL脚本中执行此操作。但是在使用Hibernate Envers的情况下,如何处理这个任务?我是否需要手动更改审计表和版本表?或者是否有任何更好的方法?

我在考虑使用基于Java的Hibernate迁移(它还会自动更新审计表),但我担心这不是正确的方式。我不知道该如何做。有任何建议吗?

英文:

I need to add some data to my DB. Simple INSERT statement. I would do it in Flyway migration SQL script. But how to approach this task when Hibernate Envers is also in place? Do I need to manually alter audit tables and revision table? Or is there any better approach?

I was thinking about java-based migration using hibernate (it would automatically update also audit tables), but I'm afraid that's not the way. I don't know, how could I do it. Any suggestions?

答案1

得分: 2

很抱歉,你除了手动操作外没有其他选择。
Envers会检测Hibernate的Session操作,所以如果你的迁移在Session之外,你需要自己修改审计表。

英文:

I am afraid that you do not have other choices than do it manually.
Envers detects Hibernate's Session operations, so if your migrations are outside the Session you have to alter audit tables yourself.

huangapple
  • 本文由 发表于 2020年7月23日 21:10:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/63055088.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定