sql-server - Flyway 是否有我们可以在 SQL 迁移中使用的“数据库名称”占位符?
问题描述
我想知道 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;
解决方案
对此有一个开放的功能请求:https ://github.com/flyway/flyway/issues/2297
推荐阅读
- regex - 匹配特定时间相关句子的正则表达式
- javascript - rethinkDB:获取对象中的第一个键名
- python - 如何以有效的方式从此类中获取数据?
- javascript - 带有可选路径参数的 react-router generatePath()
- c++ - 为什么这个 constexpr 函数会给我错误?
- scrapy - Scrapy根据字段将文件上传到S3中动态创建的目录
- flutter - LateInitializationError: 字段 'roast' 尚未初始化
- javascript - 使用 javascript 执行程序或 selenium 滚动弹出窗口?
- javascript - 使用 angular-highchart 的堆积条形图
- r - 如何使用 R 中的 cut 函数绘制绘图?