197. Spring Boot 2.0数据库迁移:Liquibase
【视频&交流平台】
à SpringBoot视频:http://t.cn/R3QepWG
à SpringCloud视频:http://t.cn/R3QeRZc
à Spring Boot源码:https://gitee.com/happyangellxq520/spring-boot
à Spring Boot交流平台:http://412887952-qq-com.iteye.comhttps://blog.csdn.net/blog/2321532
à Spring Boot Shiro视频:http://t.cn/R3QDMbh
à Spring Boot 2.0 之Spring Data 和JPA:http://t.cn/R1pSojf
历史相关章节:
195. Spring Boot 2.0数据库迁移:Flyway
196. Spring Boot 数据库迁移:Liquibase
说明:
(1)Spring Boot 版本:2.0.0.RELEASE
(2)Liquibase版本:3.5.5
前言:
在上一节中spring boot使用了1.5.12.RELEASE,这里我们要看看2.0.0.RELEASE的一个使用情况。大体的思路和上一篇是使用的,这里我们在上一篇文章的基础上进行调整。
一、版本说明
这里的Spring Boot版本使用的是2.0.0.RELEASE,Liquibase这里还是3.5.5的版本的。
二、准备工作
在上一篇的基础上,我们首先要修改下配置文件application.properties,因为在2.0.0配置路径的配置项修改了,如下配置:
spring.liquibase.change-log= classpath:/db/changelog/db.changelog-master.sql
当1.5.12版本是如下配置:
liquibase.change-log= classpath:/db/changelog/db.changelog-master.sql
这里由于Liquibase的版本还是3.5.5版本的,所以不需要数据库的表结构信息就可以测试了。
三、测试
到这里就可以运行测试了,顺利的话, 一切就会如之前一样的效果了。
四、配置说明
对于2.x的版本,Liquibase的配置加上了spring的前缀,如下配置:
# LIQUIBASE (LiquibaseProperties)
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
spring.liquibase.check-change-log-location=true # Whether to check that the change log location exists.
spring.liquibase.contexts= # Comma-separated list of runtime contexts to use.
spring.liquibase.default-schema= # Default database schema.
spring.liquibase.drop-first=false # Whether to first drop the database schema.
spring.liquibase.enabled=true # Whether to enable Liquibase support.
spring.liquibase.labels= # Comma-separated list of runtime labels to use.
spring.liquibase.parameters.*= # Change log parameters.
spring.liquibase.password= # Login password of the database to migrate.
spring.liquibase.rollback-file= # File to which rollback SQL is written when an update is performed.
spring.liquibase.url= # JDBC URL of the database to migrate. If not set, the primary configured data source is used.
spring.liquibase.user= # Login user of the database to migrate.
Spring Boot 1.x的版本的配置如下:
# LIQUIBASE (LiquibaseProperties)
liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml # Change log configuration path.
liquibase.check-change-log-location=true # Check the change log location exists.
liquibase.contexts= # Comma-separated list of runtime contexts to use.
liquibase.default-schema= # Default database schema.
liquibase.drop-first=false # Drop the database schema first.
liquibase.enabled=true # Enable liquibase support.
liquibase.labels= # Comma-separated list of runtime labels to use.
liquibase.parameters.*= # Change log parameters.
liquibase.password= # Login password of the database to migrate.
liquibase.rollback-file= # File to which rollback SQL will be written when an update is performed.
liquibase.url= # JDBC url of the database to migrate. If not set, the primary configured data source is used.
liquibase.user= # Login user of the database to migrate.
「SpringCloud视频」最近更新:
24. 覆写Feign的默认配置Configuration之Contract 25. Spring Cloud中关于Feign的常见问题总结 26. 解决Spring Cloud中FeignRibbon第一次请求失败的方法 27. Feign添加 fallbackFactory 属性来触发请求进行容灾降级 28. 断路器Hystrix总结 29. Health Indicator(健康指标) 和metrics stream(指标流) 30. 断路器监控(Hystrix Dashboard) 31. 断路器聚合监控(turbine)
SpringCloud视频:http://t.cn/R3QeRZc
微信公众号「SpringBoot」最近更新:
Java8新特性:接口的默认方法 208. Spring Boot Swagger2:排序 – 漂游记 207. Spring Boot Swagger2:极简方式 我读的书很多,但都没有你好看【一禅录】 206. Spring Boot 2.0 Swagger2:使用 205. Spring Boot 2.0 Swagger2:初识Swagger 当要离开的时候,我却动情了 205. jetcache:你需要知道的小技巧 204. jetcache:在Spring Boot中怎么玩? 遇见阿里,遇见自己 203. 阿里jetcache 202. 阿里Pandora Boot 微信公众号赞赏功能升级了,真的假的? 《喜剧之王》「我养你啊」之人生选择 201. Spring Boot JNDI:Spring Boot中怎么玩JNDI 510阿里日,马老师献上最走心、最科技范儿证婚词~ 200. Spring Boot JNDI:在Tomcat中怎么玩JNDI? 199. Spring Boot JNDI:这是虾米? Spring Boot 数据库迁移系列 Spring Boot葵花宝典:初露锋芒:MyBatis insert异常 Parameter 'name' not found 198. Spring Boot Flyway工作原理
搜索「springboot」或者扫描以下二维码即可关注:
- 【译】Spring Boot 2.0 官方迁移指南
- spring boot 集成quartz 2.0 实现前端动态配置(获取spring上下文)的两种方式,启动数据库中已开启定时任务
- 数据库迁移工具Flyway对比Liquibase
- Asp.net 2.0 Webpart 数据库的迁移 aspnet_regsql.exe Access
- ASP.NET 2.0与SQL Express 2005在迁移到Windows 2003时发生数据库为只读的错误
- 让开发自动化: 实现自动化数据库迁移——使用 LiquiBase 管理数据库变更(转载)
- MySql 使用 EF Core 2.0 CodeFirst、DbFirst、数据库迁移(Migration)介绍及示例
- yii2.0数据库迁移教程【多个数据库同时同步数据】
- 使用LiquiBase管理数据库的迁移
- Asp.net 2.0 Webpart 数据库的迁移
- django 2.0 添加外键后,迁移数据库的提示缺少参数on_delete问题
- MySql 使用 EF Core 2.0 CodeFirst、DbFirst、数据库迁移(Migration)介绍及示例
- 浅谈SpringBoot之开启数据库迁移的FlyWay使用
- hishop6.0和易分销2.0数据库迁移手册
- Asp.net 2.0 Webpart 数据库的迁移
- 【官方文档】Spring Boot 2.0 迁移指南 【已翻译54%】
- SpringBoot2.0 集成Reids,作为数据库或者缓存。并支持CRUD
- 浅谈Spring Boot 2.0迁移指南主要注意点
- SpringBoot之开启数据库迁移的FlyWay使用
- zabbix 数据库迁移