问题描述
当我尝试在MSSQL和MySQL上运行Liquibase校验和时,我遇到了问题.
I have a problem with Liquibase checksum when I try to run it on MSSQL and MySQL.
在我的基于MSSQL的数据库中,我有一个带有此校验和的变更日志条目:
In my MSSQL-base I have a changelog-entry with this checksum:
3:cf2f5de7a1dcc738bbc185e25fbcf6c9
当我对该数据库运行liquibase时,它就可以正常工作.
When I run my liquibase against this database, it works just fine.
然后,我将changelog条目复制到我的MySQL数据库中并尝试运行,并得到此错误:
Then, I copy the changelog-entry to my MySQL-database and try to run, and get this error:
myLiquibase.xml::1::Tobb is now: 3:cedf7a8ba54ea3f83141f79
我尝试在MSSQL中将校验和设置为null
,以便重新生成校验和,然后校验和恢复为
I have tried setting the checksum to null
in my MSSQL in order to regenerate the checksum, and the checksum reverts back to
3:cf2f5de7a1dcc738bbc185e25fbcf6c9
在MySQL中执行相同操作时,我得到以下校验和:
When doing the same in MySQL, i get this checksum:
3:cedf7a8ba54ea3f83141f7987007deb7
因此,据我所见,根据它是在MSSQL还是MySQL中运行,Liquibase会生成不同的校验和.怎么会这样我以为校验和仅取决于liquibase-script的实际内容?
So, from what I can see, depending on whether it's run in MSSQL or MySQL, Liquibase generates a different checksum. How can this happen? I thought the checksum was only dependant on the actual content of the liquibase-script?
推荐答案
是的,它取决于内容和数据库类型,因为实际上校验和不取决于您的changeset
文本,而是取决于 sql ,它是为当前数据库生成的,对于不同的数据库,它会稍有不同.
Yes, it depends on content and DB type, because actually checksum depends not on your changeset
text, but on sql which is generated for current DB, which will slightly different for different DBs.
如果要避免校验和错误,可以在变更集中使用validCheckSum
标记.
If you want to avoid checksum erros, you can use validCheckSum
tag in changesets.
这篇关于Liquibase-校验和因不同的数据库供应商而异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!