春季Flyway DB升级程序 [英] Flyway DB Upgrader in Spring
本文介绍了春季Flyway DB升级程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Spring Flyway模式升级程序有问题.我的servlet.xml中存在以下代码
I've a problem with the Flyway schema upgrader for Spring. Following code exists in my servlet.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/database"/>
<property name="username" value="root"/>
<property name="password" value="password"/>
</bean>
<bean id="flyway" class="com.googlecode.flyway.core.Flyway" init-method="migrate" depends-on="dataSource">
<property name="dataSource" ref="dataSource"/>
</bean>
但是如何设置迁移脚本目录,或者是默认目录是什么?
But how to set the migration script directory or rather whats the default directory?
推荐答案
如果您想更改默认目录(如上图所示为db/migration
),我认为这应该可以工作(请参阅:
If you want to alter the default directory (which is db/migration
as shown on the picture above), I believe this should work (see: Flyway.setBaseDir()
):
<bean id="flyway" class="com.googlecode.flyway.core.Flyway" init-method="migrate" depends-on="dataSource">
<property name="dataSource" ref="dataSource"/>
<property name="baseDir" value="my/migrations/path"/>
</bean>
这篇关于春季Flyway DB升级程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文