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); } } }
final FileSystemResource sqlScriptResource = new FileSystemResource(migration.getResolvedMigration().getPhysicalLocation()); final MigrationExecutor migrationExecutor = new CapturingSqlMigrationExecutor(sqlStatements, dbSupport, migration.getType(), migration.getScript(), migration.getResolvedMigration().getChecksum(), null, null,
protected static MigrationVersion findFirstVersion(Flyway flyway, String... locations) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { Collection<ResolvedMigration> migrations = resolveMigrations(flyway, locations); if (CollectionUtils.isEmpty(migrations)) { return MigrationVersion.EMPTY; } else { return Iterables.getFirst(migrations, null).getVersion(); } }
protected static Collection<ResolvedMigration> resolveMigrations(Flyway flyway, String... locations) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { MigrationResolver resolver = createMigrationResolver(flyway, locations); if (flywayVersion >= 52) { Object configInstance = getField(flyway, "configuration"); Class<?> contextType = ClassUtils.forName("org.flywaydb.core.api.resolver.Context", classLoader); Object contextInstance = ProxyFactory.getProxy(contextType, (MethodInterceptor) invocation -> "getConfiguration".equals(invocation.getMethod().getName()) ? configInstance : invocation.proceed()); return invokeMethod(resolver, "resolveMigrations", contextInstance); } else { return resolver.resolveMigrations(); } }
final FileSystemResource sqlScriptResource = new FileSystemResource(migration.getResolvedMigration().getPhysicalLocation()); final MigrationExecutor migrationExecutor = new CapturingSqlMigrationExecutor(sqlStatements, dbSupport, migration.getType(), migration.getScript(), migration.getResolvedMigration().getChecksum(), null, 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); } } }
protected static MigrationVersion findLastVersion(Flyway flyway, String... locations) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { Collection<ResolvedMigration> migrations = resolveMigrations(flyway, locations); if (CollectionUtils.isEmpty(migrations)) { return MigrationVersion.EMPTY; } else { return Iterables.getLast(migrations).getVersion(); } }