Flyway DB Upgrader in Spring

旧城冷巷雨未停 提交于 2020-01-15 09:14:11

问题


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?


回答1:


Everything is explained in the excellent documentation:

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>


来源:https://stackoverflow.com/questions/9025516/flyway-db-upgrader-in-spring

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