1 | |
package liquibase.integration.ant; |
2 | |
|
3 | |
import liquibase.Liquibase; |
4 | |
import org.apache.tools.ant.BuildException; |
5 | |
|
6 | |
import java.io.Writer; |
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | 0 | public class DatabaseRollbackFutureTask extends BaseLiquibaseTask { |
12 | |
|
13 | |
@Override |
14 | |
public void execute() throws BuildException { |
15 | 0 | super.execute(); |
16 | |
|
17 | 0 | Liquibase liquibase = null; |
18 | |
try { |
19 | 0 | Writer writer = createOutputWriter(); |
20 | 0 | if (writer == null) { |
21 | 0 | throw new BuildException("rollbackFutureDatabase requires outputFile to be set"); |
22 | |
} |
23 | |
|
24 | 0 | liquibase = createLiquibase(); |
25 | |
|
26 | 0 | liquibase.futureRollbackSQL(getContexts(), writer); |
27 | |
|
28 | 0 | writer.flush(); |
29 | 0 | writer.close(); |
30 | 0 | } catch (Exception e) { |
31 | 0 | throw new BuildException(e); |
32 | |
} finally { |
33 | 0 | closeDatabase(liquibase); |
34 | 0 | } |
35 | 0 | } |
36 | |
} |