LiquiBase预判断
来源:互联网 发布:linux 禅道 怎么启动 编辑:程序博客网 时间:2024/06/05 03:24
预判断解决的问题:运行liquibase之前,DB中已经存在一个table,所以需要加上预判断;
完整的一个例子:
<?xml version="1.0" encoding="utf-8"?>
<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.1.xsd">
<property name="now" value="now()" dbms="mysql,h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="now" value="sysdate" dbms="oracle"/>
<changeSet id="20151108112500" author="WWW">
<!-- 预判断-->
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="MYTABLE"/>
</not>
</preConditions>
<createTable tableName="MYTABLE">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="title" type="varchar(100)"/>
<column name="content" type="text">
<constraints nullable="false" />
</column>
<column name="course_id" type="bigint"/>
<column name="chapter_id" type="varchar(40)"/>
<column name="user_id" type="bigint">
<constraints nullable="false" />
</column>
<column name="reply_count" type="int"/>
<column name="same_ask_count" type="int"/>
<column name="browse_count" type="int"/>
<column name="time" type="bigint"/>
<column name="status" type="varchar(10)"/>
<column name="created_by" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="created_date" type="timestamp" defaultValueDate="${now}">
<constraints nullable="false"/>
</column>
<column name="last_modified_by" type="varchar(50)"/>
<column name="last_modified_date" type="timestamp"/>
</createTable>
</changeSet>
</databaseChangeLog>
0 0
- LiquiBase预判断
- liquibase
- Liquibase+spring
- liquibase安装
- Liquibase使用
- Liquibase 接触
- Liquibase 筆記
- Liquibase --- Database Change Management
- LiquiBase实战总结
- 如何使用Liquibase
- spring boot 配置liquibase
- liquibase入门实战
- liquibase配置(MAVEN)
- 数据库重构工具 LiquiBase(5 Liquibase被锁)
- liquibase-maven-plugin 报错
- 在项目中使用Liquibase
- 使用 LiquiBase 管理数据库变更
- Spring3+Mybatis3+Mysql+ivy+liquibase 集成
- 子类与父类之间的方法重载、隐藏、重写与虚方法调用
- 1082. Read Number in Chinese (25)
- 一些不错技术博客列表 长期更新~~
- 播放音效 播放音乐
- 2016年LinuxMint将带来更多有趣更新
- LiquiBase预判断
- 修改环境变量导致无法登录系统
- 信息查找的利器:搜索引擎
- caffe添加新层教程
- React Diff剖析
- 关于tomcat内存问题解决方法
- Volley+Cache 实现GridWall图片加载
- nodejs模块使用(Mac)
- 研发经理的职责