Question

I've got this 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>

I run update in cmd

gradle update

and it adds table to database.

But how to rollback? When I do like this

gradle rollback -Dliquibase.tag=version_1.3

I've got an error - unexpected value version_1.3: paramters must start with a "--"

What is the problem?

Was it helpful?

Solution 2

The problem is with plugin 0.7. When I use plugin 0.6.1 it works fine. Also I slightly changed .xml

<changeSet id="153" author="user">
            <createTable tableName="ToRollback" schemaName="scheme">
                <column name="id" type="int"/>
            </createTable>
            <rollback>
                <dropTable tableName="ToRollback" schemaName="scheme"/>
            </rollback>
</changeSet>

And now when I set tags gradle tag -Dliquibase.tag=230 then update database and then make gradle rollback -Dliquibase.tag=230 it works properly

OTHER TIPS

With liquibase-gradle plugin version 1.2.1, the tag value needs to be passed so:

./gradlew rollback -PliquibaseCommandValue="1.3"

As per the documentation at https://github.com/liquibase/liquibase-gradle-plugin/blob/Release_1.2.1/README.md (refer the last point of the document)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top