Flyway's support for Groovy-migrations & conditional environment-specific data insertions

寵の児 提交于 2019-12-07 09:48:06

问题


We are working on a Grails-project, and exploring Flyway as a db-migration tool for us.

In our current architecture, we rely on Groovy-migration scripts (executed at application-startup) for conditional environment-specific data insertions (say 'some-data' in 'tableA' for Production against 'other-data' in the same table 'tableA' for pre-Production).

Q1. Does Flyway support Groovy-migration scripts?

Q2. If not, then how best can we achieve conditional environment-specific data insertions?


回答1:


Q1: Java-based migrations are loaded as binary classes at runtime. Whether the source was Java or Groovy shouldn't matter here. So yes, writing them in Groovy should work.

Q2: Flyway supports multiple locations to load migrations from. These locations can then be configured differently per environment (in your case for PROD & PRE-PROD). You can use this to include different data based on the environment Flyway runs in.



来源:https://stackoverflow.com/questions/13153104/flyways-support-for-groovy-migrations-conditional-environment-specific-data-i

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