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编辑器.就其功能而言,主要功能已经实现,一些小的不影响使用的功能由于时间关系还没有完成:但就代码而言,之 ...
随机推荐
- HTML基础(1)——样式表
样式表按出现的位置可以分为:行间(内联)样式表,内部样式表,外部样式表. 行间(内联)样式表:由于要将表现和内容混杂在一起,内联样式会损失掉样式表的许多优势. <div style=" ...
- centos7安装bbr
centos7安装bbr 安装 sudo wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.s ...
- ssh hibernate修改数据库
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in rea ...
- el-checkbox遇到的问题
在官网中有实例 <template> <el-checkbox :indeterminate="isIndeterminate" v-model="ch ...
- WIN8外包公司—长年承接WIN8(surface)应用外包—北京动点飞扬软件
WIN8外包公司—长年承接WIN8(surface)应用外包 一.我们长年专门承接WIN8外包.Surface外包. WPF 外包.HTML5外包.WindowsPhone 外包.Silverligh ...
- 使用 R 语言挖掘 QQ 群聊天记录
1.获取数据 从 QQ 消息管理器中导出消息记录,保存的文本类型选择 txt 文件.这里获取的是某群从 2016-04-18 到 2016-05-07 期间的聊天记录,记录样本如下所示. 消息记录(此 ...
- C语言获取Linux系统精确时间
gettimeofday()函数的使用方法 1.函数原型 #include <sys/time.h> int gettimeofday(struct timeval *tv, struct ...
- 省市区三级联选select2.js
<div class="mui-input-row row_then" id='showCityPicker3'> <input id='cityResult3' ...
- mongodump and mongorestore
mongoexport和mongoimport只能导出/导入某个特定集合 1 mongoexport bin目录下 ./mongoexport <hostname><:port> ...
- 『TensorFlow』网络操作API_下
一.优化器基类介绍 标注一点,优化器中的学习率可以是tensor,这意味着它可以feed, learning_rate: A Tensor or a floating point value. 正常使 ...