使用 gradle 回滚 liquibase

lap*_*ots 2 gradle

我有这个 databaseChangeLog

<?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">

<preConditions>
    <dbms type="postgresql"/>
</preConditions>

<changeSet id="rollback1" author="user">
    <tagDatabase tag="version_1.3">
        <createTable tableName="roolback" schemaName="scheme">
            <column name="id" type="int"/>
        </createTable>
        <rollback>
            <dropTable tableName="roolback"/>
        </rollback>
    </tagDatabase>
</changeSet>


</databaseChangeLog>
Run Code Online (Sandbox Code Playgroud)

我update在cmd中运行

gradle update
Run Code Online (Sandbox Code Playgroud)

并将表添加到数据库中。

但是如何回滚?当我喜欢这个的时候

gradle rollback -Dliquibase.tag=version_1.3
Run Code Online (Sandbox Code Playgroud)

我有一个错误 - unexpected value version_1.3: paramters must start with a "--"

问题是什么?

小智 5

对于 liquibase-gradle 插件版本 1.2.1,需要传递标签值,因此:

./gradlew rollback -PliquibaseCommandValue="1.3"
Run Code Online (Sandbox Code Playgroud)

根据https://github.com/liquibase/liquibase-gradle-plugin/blob/Release_1.2.1/README.md 上的文档(请参阅文档的最后一点)