Reputation: 107
I have a simple changeset for creating a table and the rollback is drop'ing the same. I want a rollback script to be generated each time springboot is started. Any help?. many thanks.
Upvotes: 2
Views: 3683
Reputation: 107
liquibase.rollback-file
is the field which can be used to generate a roll-back script by spring-boot. Which we need to run manually to rollback.
Upvotes: 2
Reputation: 340
It sounds like you this in place:
<changeSet id="new_table_change" author="the_man">
<createTable tableName="new_table">
<column name="id" type="int"/>
</createTable>
<rollback>
<dropTable tableName="new_table"/>
</rollback>
</changeSet>
With this in place, you can always, as part of your pipeline, you can generate the rollback script with the following command:
mvn liquibase:futureRollbackSQL
For your current problem, if your environment allows, you can do the following:
mvn liquibase:rollbackToDateSQL <date_time>
) or number of steps (mvn liquibase:rollbackCountSQL <no_of_steps>
)mvn liquibase:futureRollbackSQL
and save the resultsUpvotes: 0