Search in sources :

Example 11 with ResolvedMigrationImpl

use of org.flywaydb.core.internal.resolver.ResolvedMigrationImpl in project flyway by flyway.

the class MigrationInfoServiceImplSmallTest method createResolvedMigration.

/**
     * Creates a new resolved migration with this version.
     *
     * @param version The version of the migration.
     * @return The resolved migration.
     */
private ResolvedMigration createResolvedMigration(int version) {
    ResolvedMigrationImpl migration = new ResolvedMigrationImpl();
    migration.setVersion(MigrationVersion.fromVersion(Integer.toString(version)));
    migration.setDescription("abc");
    migration.setScript("x");
    migration.setType(MigrationType.SQL);
    return migration;
}
Also used : ResolvedMigrationImpl(org.flywaydb.core.internal.resolver.ResolvedMigrationImpl)

Example 12 with ResolvedMigrationImpl

use of org.flywaydb.core.internal.resolver.ResolvedMigrationImpl in project ArachneCentralAPI by OHDSI.

the class ApplicationContextAwareSpringJdbcMigrationResolver method resolveMigrations.

@SuppressWarnings("unchecked")
@Override
public Collection<ResolvedMigration> resolveMigrations() {
    // get all beans of type ApplicationContextAwareSpringMigration from the application context
    Map<String, ApplicationContextAwareSpringMigration> springJdbcMigrationBeans = this.applicationContext.getBeansOfType(ApplicationContextAwareSpringMigration.class);
    ArrayList<ResolvedMigration> resolvedMigrations = new ArrayList<ResolvedMigration>();
    // resolve the migration and populate it with the migration info
    for (ApplicationContextAwareSpringMigration springJdbcMigrationBean : springJdbcMigrationBeans.values()) {
        ResolvedMigrationImpl resolvedMigration = extractMigrationInfo(springJdbcMigrationBean);
        resolvedMigration.setPhysicalLocation(ClassUtils.getLocationOnDisk(springJdbcMigrationBean.getClass()));
        resolvedMigration.setExecutor(new ApplicationContextAwareSpringJdbcMigrationExecutor(springJdbcMigrationBean));
        resolvedMigrations.add(resolvedMigration);
    }
    Collections.sort(resolvedMigrations, new ResolvedMigrationComparator());
    return resolvedMigrations;
}
Also used : ResolvedMigrationComparator(org.flywaydb.core.internal.resolver.ResolvedMigrationComparator) ArrayList(java.util.ArrayList) ResolvedMigration(org.flywaydb.core.api.resolver.ResolvedMigration) ResolvedMigrationImpl(org.flywaydb.core.internal.resolver.ResolvedMigrationImpl)

Aggregations

ResolvedMigrationImpl (org.flywaydb.core.internal.resolver.ResolvedMigrationImpl)12 FlywayException (org.flywaydb.core.api.FlywayException)6 MigrationVersion (org.flywaydb.core.api.MigrationVersion)6 ArrayList (java.util.ArrayList)4 ResolvedMigration (org.flywaydb.core.api.resolver.ResolvedMigration)4 MigrationChecksumProvider (org.flywaydb.core.api.migration.MigrationChecksumProvider)3 MigrationInfoProvider (org.flywaydb.core.api.migration.MigrationInfoProvider)3 ResolvedMigrationComparator (org.flywaydb.core.internal.resolver.ResolvedMigrationComparator)3 MigrationType (org.flywaydb.core.api.MigrationType)2 Resource (org.flywaydb.core.internal.util.scanner.Resource)2 Hashing (com.google.common.hash.Hashing)1 ByteSource (com.google.common.io.ByteSource)1 IOException (java.io.IOException)1 String.format (java.lang.String.format)1 SQLException (java.sql.SQLException)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1