LiquiBase 学习
preconditions
mysql database is installed
maven has been setted up properly
add depedenceies
- apply plugin: 'java'
- apply plugin: 'application'
- apply plugin: 'eclipse'
- apply plugin: 'maven'
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
- version = '1.0.0'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
testCompile group: "junit", name: "junit", version: "$junitVersion"
compile group: "log4j", name: "log4j", version: "1.2.17"
compile group: "org.slf4j", name: "slf4j-log4j12", version: "1.7.5"
compile group: "mysql", name: "mysql-connector-java", version: "5.1.31"
compile group: "org.liquibase", name: "liquibase-core", version: "3.3.5"
}
update database by liquibase API
- public class Main {
- public static void main(String[] args) throws CommandLineParsingException, IOException {
- List<String> defaultArgs = Arrays.asList(
- "--logLevel=debug",
- "--driver=org.gjt.mm.mysql.Driver",
- "--url=jdbc:mysql://localhost/mysql",
- "--username=root",
- "--password=root",
- "--changeLogFile=update_database.xml",
- "update"
- );
- List<String> suppliedArgs = Arrays.asList(args);
- List<String> liquibaseArgs = new ArrayList<String>();
- liquibaseArgs.addAll(defaultArgs);
- liquibaseArgs.addAll(suppliedArgs);
- liquibase.integration.commandline.Main.main(liquibaseArgs.toArray(new String[liquibaseArgs.size()]));
- }
- }
- update_database.xml
- <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
- <includeAll path="update" />
- </databaseChangeLog>
folder structure
- C:\liquibase-example
- ---src
- +---main
- | +---java
- | | \---com
- | | \---liquibase
- | | \---database
- | \---resources
- | \---update
- \---test
- +---java
- \---resources
reference documents:
http://ju.outofmemory.cn/entry/90761
http://www.tuicool.com/articles/Uvm2iaj
examples
http://blog.csdn.net/gadbee5/article/details/23461883
liquibase with gradle and spring
https://alphahinex.github.io/2018/05/15/liquibase-with-gradle
LiquiBase 学习的更多相关文章
- SpringCloud学习2-Springboot监控模块(actuator)
前言 学习一项新技术最大的困难是什么? 是资料.让人高兴的是找到了一本系统学习Spring Cloud的教程,<Spring Cloud微服务实战>, 接下来的学习目标将以此书顺序演进. ...
- 尚硅谷springboot学习14-自动配置原理
配置文件能配置哪些属性 配置文件能配置的属性参照 自动配置的原理 1).SpringBoot启动的时候加载主配置类,开启了自动配置功能 @EnableAutoConfiguration 2).@Ena ...
- 学习Spring Boot:(二)启动原理
前言 主要了解前面的程序入口 @@SpringBootApplication 这个注解的结构. 正文 参考<SpringBoot揭秘 快速构建微服务体系>第三章的学习,总结下. Sprin ...
- 【原创】SpringBoot & SpringCloud 快速入门学习笔记(完整示例)
[原创]SpringBoot & SpringCloud 快速入门学习笔记(完整示例) 1月前在系统的学习SpringBoot和SpringCloud,同时整理了快速入门示例,方便能针对每个知 ...
- Liquibase+spring 初步使用
现在的工作的项目中用了liquibase,感觉挺爽的,可以跟踪.管理数据库的重构.这对于很多需求变更较大的项目是非常不错的,特别是互联网的项目.(虽然互联网Nosql已经非常流行,不过俺觉得传统关系型 ...
- Flyway对比Liquibase(转)
数据库迁移工具. 很多应用的运行是需要数据库支持的,而随着快速迭代,产品更替的节奏加快,除了产品本身需要不断更新以外,数据库也需要做出合适的管理了. 为什么需要数据库迁移管理 比如第一个版本的产品只包 ...
- 使用 Liquibase 管理数据库版本 - SpringBoot 2.7 .2 实战基础
优雅哥 SpringBoot 2.7 .2 实战基础 - 05 -使用 Liquibase 管理数据库版本 在企业开发中,数据库版本管理好像是一个伪命题,大多项目都是通过 Power Designer ...
- 从直播编程到直播教育:LiveEdu.tv开启多元化的在线学习直播时代
2015年9月,一个叫Livecoding.tv的网站在互联网上引起了编程界的注意.缘于Pingwest品玩的一位编辑在上网时无意中发现了这个网站,并写了一篇文章<一个比直播睡觉更奇怪的网站:直 ...
- Angular2学习笔记(1)
Angular2学习笔记(1) 1. 写在前面 之前基于Electron写过一个Markdown编辑器.就其功能而言,主要功能已经实现,一些小的不影响使用的功能由于时间关系还没有完成:但就代码而言,之 ...
随机推荐
- HDU 1043 Eight(八数码)
HDU 1043 Eight(八数码) 00 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Descr ...
- 3、zabbix配置入门
Zabbix模板 zabbix组件: zabbix-server zabbix-database zabbix-web zabbix-agent zabbix-proxy ...
- fast-route的使用
<?php require 'vendor/autoload.php'; // 通过 FastRoute\simpleDispatcher() 方法定义路由,第一个参数必须是 FastRoute ...
- dedecms 模版里格式化时间标签
<!--带时分秒--> [field:pubdate function="GetDateTimeMK(@me)"/] <!--只有日期--> [field: ...
- Flask之项目创建,路由以及会话控制
Flask Flask诞生于2010年,是Armin ronacher(人名)用 Python 语言基于 Werkzeug 工具箱编写的轻量级Web开发框架. Flask 本身相当于一个内核,其他几乎 ...
- 『TensorFlow』读书笔记_多层感知机
多层感知机 输入->线性变换->Relu激活->线性变换->Softmax分类 多层感知机将mnist的结果提升到了98%左右的水平 知识点 过拟合:采用dropout解决,本 ...
- MongoDB学习笔记——数据库的创建与初始
Part1:MongoDB与SQL的概念对比 图片来源--菜鸟教程 Part2:MongoDB安装地址 直接下载地址:戳这里 备用地址:戳这里 通过备用地址(官网)下载时,要注意下面这个地方 Part ...
- Android设备终端监控可能用到的工具
先记录工具,以后详细分析 add-property-tagcheck-lost+foundcpueatercpustatsdaemonizedexdumpdirectiotestfiokexecloa ...
- frameset,iframe框架之间如何互相调用变量、函数
以往一直在编写的都是前台的UI,很少使用到frameset.iframe,对其了解也是十分有限,只是知道其可以为其当前页面引入html文件成为当前页的一部分,但是这两天在做后台UI界面的时候,发现这样 ...
- tensorboard中show不出来数据
tensorboard中show不出来数据,可通过在命令中加入training解决,如下: tensorboard --logdir==training:model_dir