@Override public Object doInTransaction() throws SQLException { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.beforeMigrate(connectionUserObjects); return null; } });
@Override public Object doInTransaction() throws SQLException { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.afterMigrate(connectionUserObjects); return null; } });
private void doMigrate(final MigrationInfo migration, final MigrationExecutor migrationExecutor, final String migrationText) throws SQLException { for (final FlywayCallback callback : callbacks) { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.beforeEachMigrate(connectionUserObjects, migration); } dbSupportUserObjects.changeCurrentSchemaTo(schema); migrationExecutor.execute(connectionUserObjects); LOG.debug("Successfully completed migration of " + migrationText); for (final FlywayCallback callback : callbacks) { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.afterEachMigrate(connectionUserObjects, migration); } } }
@Override public void handle(Event event, Context context) { runner.execute(context.getConnection(), getCommands(event, context)); }
/** * Drops the Sqlg schema and data. */ protected void dropDb(Context context) { SqlgUtil.dropDb(sqlDialect(context.getConfiguration()), context.getConnection()); }
@Override public void afterEachMigrate(Connection connection, MigrationInfo info) { super.afterEachMigrate(connection, info); try { connection.commit(); } catch (SQLException e) { Assert.fail(e.getMessage()); } for (MigrationTest test : tests) { if (test.getTargetMigration().equals(info.getVersion().getVersion())) { try { test.runAssertions(); } catch (Exception e) { Assert.fail(e.getMessage()); } assertionsRan[0]++; } } } });
@Override public void handle(Event event, Context context) { Stopwatch timer = Stopwatch.createStarted(); if (event == Event.BEFORE_CLEAN) { // Use Sqlg to remove the graph before Flyway wipes out everything else dropDb(context); LOG.info("Successfully cleaned Sqlg topology (execution time " + TimeFormat.format(timer.stop().elapsed(MILLISECONDS)) + ")"); } else if (event == Event.BEFORE_MIGRATE) { // Creates a new Sqlg graph to eagerly create a schema // TODO Can we skip opening the graph is there is no schema to create? try { executor(context.getConfiguration()).execute(sqlgGraph -> { topologyEagerCreation(sqlgGraph.getTopology()); sqlgGraph.tx().commit(); }); LOG.info("Successfully created Sqlg topology (execution time " + TimeFormat.format(timer.stop().elapsed(MILLISECONDS)) + ")"); } catch (Exception e) { throw new FlywayException("Sqlg topology creation failed", e); } } }
@Override public void handle(Event event, Context context) { runner.execute(context.getConnection(), getCommands(event, context)); }
private void doMigrate(final MigrationInfo migration, final MigrationExecutor migrationExecutor, final String migrationText) throws SQLException { for (final FlywayCallback callback : callbacks) { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.beforeEachMigrate(connectionUserObjects, migration); } dbSupportUserObjects.changeCurrentSchemaTo(schema); migrationExecutor.execute(connectionUserObjects); LOG.debug("Successfully completed migration of " + migrationText); for (final FlywayCallback callback : callbacks) { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.afterEachMigrate(connectionUserObjects, migration); } } }
@Override public Object doInTransaction() throws SQLException { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.beforeMigrate(connectionUserObjects); return null; } });
@Override public Object doInTransaction() throws SQLException { dbSupportUserObjects.changeCurrentSchemaTo(schema); callback.afterMigrate(connectionUserObjects); return null; } });
JdbcTemplate jdbcTemplate = new JdbcTemplate(new SingleConnectionDataSource(context.getConnection(), true)); jdbcTemplate.execute("select 1 from APP_REGISTRATION"); migrateToInitial = false;