英文:
Flyway sort sql files with java class
问题
-
之前,我们添加了
V1__XX.sql、V2__YY.sql和V19_ZZ.sql这些 SQL 文件,用于由 Flyway 应用。 -
然后我们引入了一个名为
V20_JJ.java的 Java 迁移类。 -
现在,当我们添加
V21_NN.sql时,我们会遇到Detected resolved migration not applied to database错误。
是否有可能按名称将 Java 和 SQL 迁移都按顺序放置?
(我们希望不使用 ignore missing migrations 或 out of order 特性,除非它们是最后的选择。)
英文:
-
Previously, we added:
V1__XX.sql,V2__YY.sqlandV19_ZZ.sqlsql files to be applied by Flyway. -
Then we introduced a Java migration class named:
V20_JJ.java. -
Now, when we add
V21_NN.sql, we get ofcDetected resolved migration not applied to databaseerror.
Is it possible to put java and sql migrations all in order by name?
(We'd prefer not to use the ignore missing migrations or out of order features unless they are a last resort)
答案1
得分: 0
能解释一下为什么会出现错误吗?如果已经应用了迁移 V1、V2... V20,那么在添加迁移 V21 时就不应该出错,因为它是按顺序的,并且没有被漏掉。
可能只是你的 V21_NN.sql 文件有问题。
英文:
Can you explain why do you get the error? In case you have migrations V1, V2... V20 already applied, you should not get error when adding migration V21 as it's in order and was not missed.
It may be just that your V21_NN.sql is incorrect.
专注分享java语言的经验与见解,让所有开发者获益!

评论