繁体   English   中英

Flyway是否有我们可以在SQL迁移中使用的“数据库名称”占位符?

[英]Does Flyway have a “database name” placeholder we can use in our SQL migrations?

我想知道flyway是否有我们可以在SQL迁移脚本中使用的某种预定义占位符?

我想要做的是在master数据库中执行一些命令,然后切换回数据库,以便运行迁移。

我的脚本看起来像这样:

USE master

-- Create things, make a small dynamic SQL string and run it in the context of my DB

${myMigrationDB}..sp_executesql @myDynamicSQL;

USE ${myMigrationDB}

-- Execute something else in the context of the db defined in flyway.url that will use what has been created previously

我知道我可以创建自己的占位符来保存数据库名称,但在我看来,我会重复一些已经可用的东西,因为它位于flyway.url配置文件中

我也知道我可以在单独的迁移中运行第二部分,但我仍然需要使用${myMigrationDB}..sp_executesql @myDynamicSQL;运行该动态SQL ${myMigrationDB}..sp_executesql @myDynamicSQL;

有一个开放功能请求: https//github.com/flyway/flyway/issues/2297

暂无
暂无

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

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