Java flyway如何初始化其数据库
在SpringJavaWeb应用程序中配置带有postgresql数据源的flyway时遇到问题 即使我这样配置,Flyway似乎也不会执行迁移操作:Java flyway如何初始化其数据库,java,spring,postgresql,tomcat,flyway,Java,Spring,Postgresql,Tomcat,Flyway,在SpringJavaWeb应用程序中配置带有postgresql数据源的flyway时遇到问题 即使我这样配置,Flyway似乎也不会执行迁移操作: <bean id="flyway" class="com.googlecode.flyway.core.Flyway" init-method="migrate"> <property name="dataSource" ref="dataSource"/> <property name="table
<bean id="flyway" class="com.googlecode.flyway.core.Flyway" init-method="migrate">
<property name="dataSource" ref="dataSource"/>
<property name="table" value="blankapp_schema_version" />
<property name="disableInitCheck" value="true" />
</bean>
没别的了
一些背景:
我的bean“dataSource”绑定如下:
<jee:jndi-lookup jndi-name="jdbc/BlankAppDataSource" id="dataSource" />
在我的META-INF/context.xml中,我有:
<Context>
<Resource name="jdbc/BlankAppDataSource"
auth="Container"
type="javax.sql.DataSource"
username="postgres"
password="Weblogic1"
schema="public"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/rvandecaveye"
/>
</Context>
如果迁移版本小于或等于blankapp_schema_version表中的架构版本,则不会运行迁移 您可以通过添加属性
initDescription
来设置初始架构版本的值
因此,要运行V001脚本,
initDescription
参数应该是0
谢谢,我必须更新我的flyway版本(我仍然使用1.5)
<Context>
<Resource name="jdbc/BlankAppDataSource"
auth="Container"
type="javax.sql.DataSource"
username="postgres"
password="Weblogic1"
schema="public"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/rvandecaveye"
/>
</Context>