use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.
the class SapHanaMigrationMediumTest method sequence.
@Test
public void sequence() throws Exception {
flyway.setLocations("migration/dbsupport/saphana/sql/sequence");
flyway.migrate();
MigrationVersion version = flyway.info().current().getVersion();
assertEquals("1", version.toString());
assertEquals("Sequence", flyway.info().current().getDescription());
flyway.clean();
flyway.migrate();
}
use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.
the class SapHanaMigrationMediumTest method trigger.
@Test
public void trigger() throws Exception {
flyway.setLocations("migration/dbsupport/saphana/sql/trigger");
flyway.migrate();
MigrationVersion version = flyway.info().current().getVersion();
assertEquals("1", version.toString());
assertEquals("Trigger", flyway.info().current().getDescription());
flyway.clean();
flyway.migrate();
}
use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.
the class SapHanaMigrationMediumTest method index.
@Test
public void index() throws Exception {
flyway.setLocations("migration/dbsupport/saphana/sql/index");
flyway.migrate();
MigrationVersion version = flyway.info().current().getVersion();
assertEquals("1", version.toString());
assertEquals("Index", flyway.info().current().getDescription());
flyway.clean();
flyway.migrate();
}
use of org.flywaydb.core.api.MigrationVersion in project killbill by killbill.
the class CapturingMetaDataTable method addAppliedMigration.
@Override
public void addAppliedMigration(final AppliedMigration appliedMigration) {
final MigrationVersion version = appliedMigration.getVersion();
final String versionStr = version == null ? null : version.toString();
final int calculateInstalledRank;
try {
calculateInstalledRank = calculateInstalledRank();
} catch (final SQLException e) {
throw new RuntimeException(e);
}
final String sql = new StringBuilder().append("INSERT INTO ").append(table).append(" (").append(dbSupport.quote("installed_rank")).append(",").append(dbSupport.quote("version")).append(",").append(dbSupport.quote("description")).append(",").append(dbSupport.quote("type")).append(",").append(dbSupport.quote("script")).append(",").append(dbSupport.quote("checksum")).append(",").append(dbSupport.quote("installed_by")).append(",").append(dbSupport.quote("execution_time")).append(",").append(dbSupport.quote("success")).append(")").append(" VALUES (").append(calculateInstalledRank + appliedMigration.getInstalledRank()).append(",").append("'").append(versionStr).append("',").append("'").append(appliedMigration.getDescription()).append("',").append("'").append(appliedMigration.getType().name()).append("',").append("'").append(appliedMigration.getScript()).append("',").append(appliedMigration.getChecksum()).append(",").append(dbSupport.getCurrentUserFunction()).append(",").append(appliedMigration.getExecutionTime()).append(",").append(appliedMigration.isSuccess()).append(")").toString();
sqlStatements.add(new SqlStatement(0, sql, false));
}
use of org.flywaydb.core.api.MigrationVersion 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