use of org.flywaydb.core.Flyway in project flyway by flyway.
the class OsgiActivator method start.
public void start(BundleContext context) throws Exception {
System.out.println("Starting Flyway Sample OSGi");
try {
Properties properties = new Properties();
properties.setProperty("flyway.driver", "org.h2.Driver");
properties.setProperty("flyway.url", "jdbc:h2:mem:flyway_db;DB_CLOSE_DELAY=-1");
properties.setProperty("flyway.user", "sa");
properties.setProperty("flyway.password", "");
Flyway flyway = new Flyway();
flyway.configure(properties);
flyway.setLocations("db.migration", "org.flywaydb.sample.osgi.fragment");
flyway.migrate();
System.out.println("New schema version: " + flyway.info().current().getVersion());
System.exit(0);
} catch (Throwable t) {
t.printStackTrace();
// System.exit(0);
}
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class SQLiteMigrationMediumTest method singleConnectionInternalDataSource.
@Test
public void singleConnectionInternalDataSource() {
Flyway flyway = new Flyway();
flyway.setDataSource("jdbc:sqlite:target/single_internal", "", "");
flyway.setDataSource(dataSource);
flyway.setLocations("migration/sql");
flyway.clean();
flyway.migrate();
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class ConcurrentMigrationTestCase method createFlyway.
private Flyway createFlyway() throws SQLException {
Flyway newFlyway = new Flyway();
newFlyway.setDataSource(concurrentMigrationDataSource);
newFlyway.setLocations(getBasedir());
newFlyway.setSchemas(schemaName);
Map<String, String> placeholders = new HashMap<String, String>();
placeholders.put("schema", schemaQuoted);
newFlyway.setPlaceholders(placeholders);
newFlyway.setBaselineVersionAsString("0.1");
return newFlyway;
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class VerticaMigrationMediumTest method emptySearchPath.
@Test
public void emptySearchPath() {
Flyway flyway1 = new Flyway();
DriverDataSource driverDataSource = (DriverDataSource) dataSource;
flyway1.setDataSource(new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, driverDataSource.getUrl(), driverDataSource.getUser(), driverDataSource.getPassword(), null) {
@Override
public Connection getConnection() throws SQLException {
Connection connection = super.getConnection();
Statement statement = null;
try {
statement = connection.createStatement();
statement.execute("SET search_path = v_catalog");
} finally {
JdbcUtils.closeStatement(statement);
}
return connection;
}
});
flyway1.setLocations(getBasedir());
flyway1.setSchemas("public");
flyway1.migrate();
}
use of org.flywaydb.core.Flyway in project flyway by flyway.
the class PostgreSQLMigrationMediumTest method emptySearchPath.
@Test
public void emptySearchPath() {
Flyway flyway1 = new Flyway();
DriverDataSource driverDataSource = (DriverDataSource) dataSource;
flyway1.setDataSource(new DriverDataSource(Thread.currentThread().getContextClassLoader(), null, driverDataSource.getUrl(), driverDataSource.getUser(), driverDataSource.getPassword(), null) {
@Override
public Connection getConnection() throws SQLException {
Connection connection = super.getConnection();
Statement statement = null;
try {
statement = connection.createStatement();
statement.execute("SELECT set_config('search_path', '', false)");
} finally {
JdbcUtils.closeStatement(statement);
}
return connection;
}
});
flyway1.setLocations(getBasedir());
flyway1.setSchemas("public");
flyway1.migrate();
}
Aggregations