use of org.flywaydb.core.internal.dbsupport.Schema in project flyway by flyway.
the class DB2zOSMigrationMediumTest method isSchemaEmpty.
/**
* Override isSchemaEmpty. Setting schema and table space in SQL.
*
* @throws Exception
*/
@Override
@Test
public void isSchemaEmpty() throws Exception {
Schema schema = dbSupport.getSchema("AURINT");
assertTrue(schema.empty());
flyway.setLocations(getMigrationDir());
flyway.baseline();
flyway.migrate();
assertFalse(schema.empty());
flyway.clean();
assertTrue(schema.empty());
}
use of org.flywaydb.core.internal.dbsupport.Schema in project flyway by flyway.
the class DB2zOSMigrationMediumTest method setCurrentSchema.
/**
* Override schema test. DB2 on zOS does not support "Create schema"
*
* @throws Exception
*/
@Override
@Test(expected = UnsupportedOperationException.class)
public void setCurrentSchema() throws Exception {
Schema schema = dbSupport.getSchema("current_schema_test");
try {
schema.create();
flyway.setSchemas("current_schema_test");
flyway.clean();
flyway.setLocations("migration/current_schema");
Map<String, String> placeholders = new HashMap<String, String>();
placeholders.put("schema1", dbSupport.quote("current_schema_test"));
flyway.setPlaceholders(placeholders);
flyway.migrate();
} finally {
schema.drop();
}
}
use of org.flywaydb.core.internal.dbsupport.Schema in project flyway by flyway.
the class EnterpriseDBDbSupportMediumTest method setCurrentSchema.
/**
* Checks that the search_path is extended and not overwritten so that objects in PUBLIC can still be found.
*/
@Test
public void setCurrentSchema() throws Exception {
Connection connection = createDataSource().getConnection();
PostgreSQLDbSupport dbSupport = new PostgreSQLDbSupport(connection);
Schema schema = dbSupport.getSchema("search_path_test");
schema.create();
dbSupport.changeCurrentSchemaTo(dbSupport.getSchema("search_path_test"));
String searchPath = dbSupport.getJdbcTemplate().queryForString("SHOW search_path");
assertEquals("search_path_test, \"$user\", public", searchPath);
schema.drop();
JdbcUtils.closeConnection(connection);
}
use of org.flywaydb.core.internal.dbsupport.Schema in project flyway by flyway.
the class HsqlMigrationMediumTest method view.
@Test
public void view() throws Exception {
Schema schema = dbSupport.getSchema("MY_VIEWS");
schema.create();
flyway.setSchemas("PUBLIC", "MY_VIEWS");
flyway.setLocations("migration/dbsupport/hsql/sql/view");
flyway.migrate();
flyway.clean();
schema.drop();
}
use of org.flywaydb.core.internal.dbsupport.Schema in project flyway by flyway.
the class FlywayMediumTest method multipleSetDataSourceCalls.
@Test
public void multipleSetDataSourceCalls() throws Exception {
DriverDataSource dataSource1 = new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:h2:mem:flyway_db_1;DB_CLOSE_DELAY=-1", "sa", "", null);
DriverDataSource dataSource2 = new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, "jdbc:h2:mem:flyway_db_2;DB_CLOSE_DELAY=-1", "sa", "", null);
Connection connection1 = dataSource1.getConnection();
Connection connection2 = dataSource2.getConnection();
Schema schema1 = new H2DbSupport(connection1).getSchema("PUBLIC");
Schema schema2 = new H2DbSupport(connection2).getSchema("PUBLIC");
assertTrue(schema1.empty());
assertTrue(schema2.empty());
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource1);
flyway.setDataSource(dataSource2);
flyway.setLocations("migration/sql");
flyway.migrate();
assertTrue(schema1.empty());
assertFalse(schema2.empty());
connection1.close();
connection2.close();
}
Aggregations