All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.harness.util.rollback.RollbackToDate.groovy Maven / Gradle / Ivy

There is a newer version: 1.0.10
Show newest version
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