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

问题描述 投票:0回答:1

我想知道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

sql-server database-migration flyway
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.