use of liquibase.command.core.GenerateChangeLogCommand in project liquibase by liquibase.
the class CommandLineUtils method doGenerateChangeLog.
public static void doGenerateChangeLog(String changeLogFile, Database originalDatabase, CatalogAndSchema[] schemas, String snapshotTypes, String author, String context, String dataDir, DiffOutputControl diffOutputControl) throws DatabaseException, IOException, ParserConfigurationException, InvalidExampleException, LiquibaseException {
CompareControl.SchemaComparison[] comparisons = new CompareControl.SchemaComparison[schemas.length];
int i = 0;
for (CatalogAndSchema schema : schemas) {
comparisons[i++] = new CompareControl.SchemaComparison(schema, schema);
}
CompareControl compareControl = new CompareControl(comparisons, snapshotTypes);
diffOutputControl.setDataDir(dataDir);
GenerateChangeLogCommand command = (GenerateChangeLogCommand) CommandFactory.getInstance().getCommand("generateChangeLog");
command.setReferenceDatabase(originalDatabase).setSnapshotTypes(snapshotTypes).setOutputStream(System.out).setCompareControl(compareControl);
command.setChangeLogFile(changeLogFile).setDiffOutputControl(diffOutputControl);
command.setAuthor(author).setContext(context);
try {
command.execute();
} catch (CommandExecutionException e) {
throw new LiquibaseException(e);
}
}
Aggregations