Skip to content

Commit

Permalink
0002364: DBExport ability to produce drop only statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Hicks, Josh committed Aug 7, 2015
1 parent 0544593 commit d95c94f
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -254,6 +254,12 @@ protected Database getDatabase(Table[] tables) {
db.addTable(newTable);
}
}
else if (addDropTable) {
for (Table table : tables) {
Table newTable = (Table) table.clone();
db.addTable(newTable);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -481,6 +487,13 @@ protected void startTable(Table table) {
DatabaseXmlUtil.write(table, writer);
}
}
else if (addDropTable) {
if (format == Format.SQL) {
IDdlBuilder target = DdlBuilderFactory.createDdlBuilder(compatible
.toString().toLowerCase());
write(target.dropTables(getDatabase(table)));
}
}

writeComment("DbExport: "
+ StringUtils.defaultString(IoVersion.getVersion().version()));
Expand Down

0 comments on commit d95c94f

Please sign in to comment.