使用flyway修补多个相同的架构 [英] using flyway to patch multiple identical schemas
问题描述
我已经仔细阅读了飞行路线文档,但是我不清楚我想要的场景是否可行.我需要在同一数据库中修补许多相同的架构,但是在编写sql脚本时我不知道所有的架构名称.
i have thoroughly read the flyway documentation but i am unclear if the scenario i want is possible or not. i need to patch many identical schemas within the same database but i do not know all the schema names at the time when i am writing the sql scripts.
我知道 schemas 参数,但是常见问题解答不适用于我的情况.
i know about the schemas parameter, but the 2 possible strategies mentioned in the FAQ do not apply to my scenario.
这种情况类似于为学生提供方案的大学:
the scenario is similar to a university providing schemas for their students:
- 我想为对象提供不带模式前缀的sql脚本
- 每个架构都应具有自己的schema_version表
- 在运行时:迁移 schemas 参数中定义的每个架构都应单独打补丁,即sql脚本应在每个架构中运行.
- i would like to provide sql scripts with no schema prefixes for objects
- every schema should have its own schema_version table
- upon flyway:migrate every schema defined in the schemas parameter should be patched separately, i.e. the sql scripts should be run in each schema.
我知道一个潜在的问题是,模式"在f.ex中的含义有所不同.甲骨文比在postgres中,所以我想知道是否有任何其他推荐的方法来实现这一目标.
i know that a potential problem is, that 'schema' means something different in f.ex. oracle than in postgres, so i wonder if there is any other recommended way to achieve this.
否则,我正在考虑自己实现此功能...如果我们自己完成此功能,是否有机会将其向上推广?
otherwise i am thinking of implementing this functionality myself...is there a chance to get this feature upstream if we do it on our own?
谢谢:)
推荐答案
您最好的机会是使用一种列出了适用架构的方法来包装Flyway,然后在将schemas属性设置为正确的情况下使每个架构运行一个Flyway.一个.
Your best chance is to wrap Flyway with a method that will list the applicable schemas, and then make one Flyway run per schema with the schemas property set to the correct one.
这确实是一个不错的功能,所以现在我要说的是将它包含在主发行版中的机会很小.
This really is a nice feature, so at this time I would say the chances are pretty slim to see it included in the main distro.
这篇关于使用flyway修补多个相同的架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!