<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2.0</version>
</dependency>
We can successfully creating tables, index, triggers, etc, but when building these out for the first time, we were getting errors from the scripts and the rollback is never executing, or at least the tables still existed. We worked through our issues and got scripts working successfully, but want to make sure the rollbacks are working. Was the rollback not executing because we are using <sqlfile>
to build out everything and using <sql>
to drop tables? What are we missing?
<?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"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="ddl_v1" author="AUTHOR_NAME" runInTransaction="true" failOnError="true">
<sqlFile path="ddl/v1/Create_Table1_And_Relations.sql" relativeToChangelogFile="true" splitStatements="true" endDelimiter="/"/>
<sqlFile path="ddl/v1/Create_Table2_And_Relations.sql" relativeToChangelogFile="true" splitStatements="true" endDelimiter="/"/>
<sqlFile path="ddl/v1/Create_Table3_And_Relations.sql" relativeToChangelogFile="true" splitStatements="true" endDelimiter="/"/>
<sqlFile path="ddl/v1/Create_Table4_And_Relations.sql" relativeToChangelogFile="true" splitStatements="true" endDelimiter="/"/>
<sqlFile path="ddl/v1/Create_Table5_And_Relations.sql" relativeToChangelogFile="true" splitStatements="true" endDelimiter="/"/>
<rollback>
<sql>DROP TABLE TABLE1;</sql>
<sql>DROP TABLE TABLE2;</sql>
<sql>DROP TABLE TABLE3;</sql>
<sql>DROP TABLE TABLE4;</sql>
<sql>DROP TABLE TABLE5;</sql>
</rollback>
</changeSet>
<changeSet id="dml_v1" author="AUTHOR_NAME" runInTransaction="true" failOnError="true">
<sqlFile path="dml/v1/Insert_TABLE1.sql" relativeToChangelogFile="true"/>
<sqlFile path="dml/v1/Insert_TABLE5.sql" relativeToChangelogFile="true"/>
</changeSet>
</databaseChangeLog>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…