use of org.flywaydb.core.internal.dbsupport.Table in project flyway by flyway.
the class SQLiteSchema method doEmpty.
@Override
protected boolean doEmpty() throws SQLException {
Table[] tables = allTables();
List<String> tableNames = new ArrayList<String>();
for (Table table : tables) {
String tableName = table.getName();
if (!IGNORED_SYSTEM_TABLE_NAMES.contains(tableName)) {
tableNames.add(tableName);
}
}
return tableNames.isEmpty();
}
use of org.flywaydb.core.internal.dbsupport.Table in project flyway by flyway.
the class H2Schema method doClean.
@Override
protected void doClean() throws SQLException {
for (Table table : allTables()) {
table.drop();
}
List<String> sequenceNames = listObjectNames("SEQUENCE", "IS_GENERATED = false");
for (String statement : generateDropStatements("SEQUENCE", sequenceNames, "")) {
jdbcTemplate.execute(statement);
}
List<String> constantNames = listObjectNames("CONSTANT", "");
for (String statement : generateDropStatements("CONSTANT", constantNames, "")) {
jdbcTemplate.execute(statement);
}
List<String> domainNames = listObjectNames("DOMAIN", "");
if (!domainNames.isEmpty()) {
if (name.equals(dbSupport.getCurrentSchemaName())) {
for (String statement : generateDropStatementsForCurrentSchema("DOMAIN", domainNames, "")) {
jdbcTemplate.execute(statement);
}
} else {
LOG.error("Unable to drop DOMAIN objects in schema " + dbSupport.quote(name) + " due to H2 bug! (More info: http://code.google.com/p/h2database/issues/detail?id=306)");
}
}
}
use of org.flywaydb.core.internal.dbsupport.Table in project flyway by flyway.
the class MySQLSchema method doClean.
@Override
protected void doClean() throws SQLException {
for (String statement : cleanEvents()) {
jdbcTemplate.execute(statement);
}
for (String statement : cleanRoutines()) {
jdbcTemplate.execute(statement);
}
for (String statement : cleanViews()) {
jdbcTemplate.execute(statement);
}
jdbcTemplate.execute("SET FOREIGN_KEY_CHECKS = 0");
for (Table table : allTables()) {
table.drop();
}
jdbcTemplate.execute("SET FOREIGN_KEY_CHECKS = 1");
}
use of org.flywaydb.core.internal.dbsupport.Table in project flyway by flyway.
the class DB2Schema method generateDropVersioningStatement.
/**
* @return All tables that have versioning associated with them.
*/
private List<String> generateDropVersioningStatement() throws SQLException {
List<String> dropVersioningStatements = new ArrayList<String>();
Table[] versioningTables = findTables("select TABNAME from SYSCAT.TABLES where TEMPORALTYPE <> 'N' and TABSCHEMA = ?", name);
for (Table table : versioningTables) {
dropVersioningStatements.add("ALTER TABLE " + table.toString() + " DROP VERSIONING");
}
return dropVersioningStatements;
}
Aggregations