【发布时间】:2017-07-31 05:08:36
【问题描述】:
我正在使用 postgres 数据库:
Maven pom.xml:
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">`enter code here`
<modelVersion>4.0.0</modelVersion>`enter code here`
<groupId>testing</groupId>
<artifactId>CubeGenerator</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>CubeGenerator</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-postgresql</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<changeLogFile>/pgdb/lb/changelog.postgresql.sql</changeLogFile>
<url>jdbc:postgresql://localhost:5432/deldb</url>
<username>rolldel</username>
<password>rolldel</password>
</configuration>
<executions>
<execution>
<goals>
<goal>updateSQL</goal>
<goal>futureRollbackSQL</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Liquibase.properties:
[postgres@pgtest lb]$ cat liquibase.properties
driver: org.postgresql.Driver
classpath: /pgdb/lb/postgresql-42.1.1.jre6.jar
changeLogFile:/pgdb/lb/changelog.postgresql.sql
url: jdbc:postgresql://localhost:5432/deldb
username: rolldel
password: rolldel
更新日志:
--liquibase formatted sql
--changeset postgres:1-1
CREATE TABLE action (acn_id numeric(10) NOT NULL, trg_id numeric(10) NOT NULL, act_id numeric(10) NOT NULL, acn_configured_pig_id numeric(10) NOT NULL, acn_running_pig_id numeric(10), acn_name VARCHAR(255) NOT NULL, acn_order_no numeric(10) NOT NULL, system_generated_fl CHAR(1), acn_delete_fl CHAR(1) NOT NULL, acn_version_id numeric(10) NOT NULL, ptn_id numeric(10) NOT NULL);
CREATE TABLE action_pin (anp_id numeric(10) NOT NULL, cmp_id numeric(10) NOT NULL, act_id numeric(10) NOT NULL, anp_name VARCHAR(255) NOT NULL, anp_input_fl CHAR(1) NOT NULL, anp_order_no numeric(10) NOT NULL, system_generated_fl CHAR(1), anp_delete_fl CHAR(1) NOT NULL, anp_version_id numeric(10) NOT NULL, ptn_id numeric(10) NOT NULL);
CREATE TABLE action_pin_connection (apc_id numeric(10) NOT NULL, apc_from_acn_id numeric(10), apc_from_anp_id numeric(10), apc_from_trg_id numeric(10), apc_from_trp_id numeric(10), apc_to_acn_id numeric(10) NOT NULL, apc_to_anp_id numeric(10) NOT NULL, system_generated_fl CHAR(1), apc_delete_fl CHAR(1) NOT NULL, apc_version_id numeric(10) NOT NULL, ptn_id numeric(10) NOT NULL);
liquibase 更新正在运行,但 liquibase 回滚不起作用。
如果我在更改日志中添加--rollback drop table,那么它就可以工作了。
但是,为什么 auto rollback 不适用于创建表 SQL?
【问题讨论】:
标签: postgresql maven liquibase postgresql-9.6