using flyway to patch multiple identical schemas

守給你的承諾、 提交于 2019-12-24 01:21:34

问题


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.

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:

  • 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.

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?

thanks :)


回答1:


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.



来源:https://stackoverflow.com/questions/15476659/using-flyway-to-patch-multiple-identical-schemas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!