I have idea how to implement automatic rollback support for some refactorings.
For example dropUniqueConstraint:
At first sight it seems that liquibase cannot rollback dropping of constraint, because it doesn’t know constraint definition - only constraint name from element.
But, while performing dropUniqueConstraint change, it’s easy to get actual constraint definition from database and store it in databasechangelog.
So while performing rollback dropUniqueConstraint change can read such definition from databasechangelog and recreate constraint.
In such way, it’s possible to add automatic rollbacks for other changes:
Drop Default Value
Drop Foreign Key Constraint
Drop Primary Key Constraint
and with some restrictions (no data recovery):
In general, Change should have possibility to store some data in databasechangelog and get it back in generateRollbackStatements.