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

liquibase.integration.ant.DatabaseRollbackFutureTask Maven / Gradle / Ivy

There is a newer version: 4.30.0
Show newest version
package liquibase.integration.ant;

import liquibase.Contexts;
import liquibase.Liquibase;
import liquibase.exception.LiquibaseException;
import org.apache.tools.ant.BuildException;

import java.io.IOException;
import java.io.Writer;

public class DatabaseRollbackFutureTask extends AbstractChangeLogBasedTask {
    @Override
    public void executeWithLiquibaseClassloader() throws BuildException {
        Liquibase liquibase = getLiquibase();
        try (Writer outputFileWriter = getOutputFileWriter()) {
            liquibase.futureRollbackSQL(new Contexts(getContexts()), getLabelFilter(), outputFileWriter);
        } catch (LiquibaseException e) {
            throw new BuildException("Unable to generate future rollback SQL: " + e.getMessage(), e);
        } catch (IOException e) {
            throw new BuildException("Unable to generate future rollback SQL. Error creating output writer.", e);
        }
    }

    @Override
    protected void validateParameters() {
        super.validateParameters();

        if(getOutputFile() == null) {
            throw new BuildException("Output file is required.");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy