栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何使用Flyway配置来处理多个数据库

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何使用Flyway配置来处理多个数据库

您可以为具有不同配置的单个插件指定多个执行:

 <plugin>    <groupId>org.flywaydb</groupId>    <artifactId>flyway-maven-plugin</artifactId>    <version>3.0</version>    <executions>        <execution> <id>first-execution</id> <phase>compile</phase> <!--whatever phase you need--> <goals>     <goal>migrate</goal> </goals> <configuration>     <url>jdbc:mysql://localhost:3306/schema2</url>     <user>root</user>     <password>root</password>     <locations>         <location>  filesystem:/path/to/migrations/folder         </location>     </locations> </configuration>        </execution>        <execution> <id>second-execution</id> <phase>compile</phase> <!--whatever phase you need--> <goals>     <goal>migrate</goal> </goals> <configuration>     <url>jdbc:mysql://localhost:3306/schema1</url>     <user>root</user>     <password>root</password>     <locations>         <location>  filesystem:/path/to/other/migrations/folder         </location>     </locations> </configuration>        </execution>    </executions>    <dependencies>        <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.21</version>        </dependency>    </dependencies></plugin>

您可以使用’location’属性来定义要为每个模式运行的迁移,就像在上面的示例中所做的一样。位置类型由其前缀确定。无前缀的位置或以classpath开头的位置:指向classpath上的包,并且可能包含基于sql和基于Java的迁移。以文件系统开头的位置:指向文件系统上的目录,并且只能包含sql迁移。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/438186.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号