简体   繁体   English

如何在相同版本的flyway中执行多个sql脚本

[英]how to execute multiple sql script into flyway with same version

I want to execute multiple SQL file using flyway with same version.我想使用相同版本的 flyway 执行多个 SQL 文件。

Solution 1解决方案1

I try multiple SQL script bind into single SQL script and execute it.我尝试将多个 SQL 脚本绑定到单个 SQL 脚本中并执行它。 But now after some days new script will come and I merge into before create SQL file.但是现在几天后新脚本会出现,我在创建 SQL 文件之前合并。 That show error.那显示错误。 My requirement is I only execute one single SQL file and my database is going to update.我的要求是我只执行一个 SQL 文件并且我的数据库将要更新。

Is there any way to do that?有没有办法做到这一点?

Solution 2解决方案2

I try version name with timestamp but that is not satisfied ou requirement.我尝试使用时间戳的版本名称,但这不满足您的要求。 I want only one SQL file and when I migrate then it successfully migrate SQL file as well as when I again migrate new script then it successfully migrate it but all of this process do in single script.我只需要一个 SQL 文件,当我迁移时,它成功迁移 SQL 文件,以及当我再次迁移新脚本时,它成功迁移它,但所有这些过程都在单个脚本中完成。

Is there any way to do it?有什么办法吗?

I am using FlyWay Version 4.2.0.我正在使用 FlyWay 版本 4.2.0。

Flyway uses a history table ( flyway_schema_history ) to track which migrations were already applied. Flyway使用历史表 ( flyway_schema_history ) 来跟踪已经应用了哪些迁移。 More than that, this table has a checksum column which is done based on the content of the migration, which means if you change it, checksum will fail and your application start also.更重要的是,这个表有一个校验和列,它是根据迁移的内容完成的,这意味着如果你改变它,校验和将失败,你的应用程序也会启动。

Maybe giving the reasons behind your choice would help to give you some light on helping you.也许给出你选择背后的原因会帮助你了解帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM