最近考虑到数据库迭代一直使用手动进行sql补丁升级,有没有数据库迭代版本自动更新工具,那么我们就想到了Liquibase:https://www.liquibase.org/
集成步奏:
1.准备liquibse 2.0.5 版本jar包.
2.本人测试环境为jdk1.7+liquibase2.0.5+spring 3.0
3.注意liquibase 2.0以上版本支持sql更新;
以下为代码样例:
1.spring 配置文件中增加一下代码:
<bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase">
<property name="dataSource" ref="pmoDataSource" />
<property name="changeLog" value="/WEB-INF/pmconfig/upgrade/liquibase/db_changelog/master.xml" /> <!-- 根据自己项目设置路径 -->
<property name="contexts" value="test,production" />
</bean>
2.项目中sql存储目录