问题描述
在我们当前的体系结构中,我们依赖于Groovy迁移。我们正在开发一个Grails项目,并将Flyway作为一个db迁移工具来探索。脚本(在应用程序启动时执行)用于条件特定于环境的数据插入(例如,'tableA'中的'some-data'用于生产与'pre-Production'的相同表'tableA'中的'other-data')。 >
。 Flyway是否支持Groovy迁移脚本?
Q2。如果不是,那么我们如何才能实现条件特定于环境的数据插入?
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?
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.
这篇关于Flyway支持Groovy迁移&有条件的环境特定数据插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!