liquibase.harness.util.rollback.RollbackToDate.groovy Maven / Gradle / Ivy
package liquibase.harness.util.rollback;
import liquibase.harness.config.DatabaseUnderTest
import liquibase.harness.util.TestUtils
import java.text.SimpleDateFormat;
class RollbackToDate implements RollbackStrategy {
String rollbackDateTime;
@Override
void prepareForRollback(List databases) {
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ss")
sdf.setTimeZone(TimeZone.getTimeZone("UTC"))
rollbackDateTime = sdf.format(new Date(System.currentTimeMillis() - 1000))
}
@Override
void performRollback(Map commandArgs) {
commandArgs.put("date", rollbackDateTime)
TestUtils.executeCommandScope("rollbackToDate", commandArgs)
}
@Override
void cleanupDatabase(List databases) {
// No cleanup is needed for rollbackToDate
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy