use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource in project flyway by flyway.
the class SqlMigrationResolverSmallTest method extractScriptNameFileSystemPrefix.
@Test
public void extractScriptNameFileSystemPrefix() {
SqlMigrationResolver sqlMigrationResolver = new SqlMigrationResolver(null, scanner, new Location("filesystem:/some/dir"), PlaceholderReplacer.NO_PLACEHOLDERS, FlywayConfigurationForTests.create());
assertEquals("V3.171__patch.sql", sqlMigrationResolver.extractScriptName(new FileSystemResource("/some/dir/V3.171__patch.sql")));
}
use of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource in project killbill by killbill.
the class DbMigrateWithDryRun method applyMigration.
private void applyMigration(final int installedRnk, final MigrationInfoImpl migration) {
final MigrationVersion version = migration.getVersion();
final String migrationText;
if (version != null) {
migrationText = "schema " + schema + " to version " + version + " - " + migration.getDescription();
} else {
migrationText = "schema " + schema + " with repeatable migration " + migration.getDescription();
}
LOG.info("Migrating " + migrationText);
// PIERRE: override the executor to capture the SQL
final FileSystemResource sqlScriptResource = new FileSystemResource(migration.getResolvedMigration().getPhysicalLocation());
final MigrationExecutor migrationExecutor = new CapturingSqlMigrationExecutor(sqlStatements, dbSupport, sqlScriptResource, placeholderReplacer, encoding);
try {
doMigrate(migration, migrationExecutor, migrationText);
} catch (final SQLException e) {
throw new FlywayException("Unable to apply migration", e);
}
final AppliedMigration appliedMigration = new AppliedMigration(installedRnk, version, migration.getDescription(), migration.getType(), migration.getScript(), migration.getResolvedMigration().getChecksum(), null, null, -1, true);
metaDataTableForDryRun.addAppliedMigration(appliedMigration);
}
Aggregations