use of org.flywaydb.core.internal.metadatatable.AppliedMigration in project flyway by flyway.
the class MigrationInfoImplSmallTest method validate.
@Test
public void validate() {
MigrationVersion version = MigrationVersion.fromVersion("1");
String description = "test";
MigrationType type = MigrationType.SQL;
ResolvedMigrationImpl resolvedMigration = new ResolvedMigrationImpl();
resolvedMigration.setVersion(version);
resolvedMigration.setDescription(description);
resolvedMigration.setType(type);
resolvedMigration.setChecksum(456);
AppliedMigration appliedMigration = new AppliedMigration(1, version, description, type, null, 123, new Date(), "abc", 0, true);
MigrationInfoImpl migrationInfo = new MigrationInfoImpl(resolvedMigration, appliedMigration, new MigrationInfoContext(), false);
String message = migrationInfo.validate();
assertTrue(message.contains("123"));
assertTrue(message.contains("456"));
}
use of org.flywaydb.core.internal.metadatatable.AppliedMigration 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