Search in sources :

Example 6 with ResolvedMigrationComparator

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

the class SqlMigrationResolver method resolveMigrations.

public List<ResolvedMigration> resolveMigrations() {
    List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>();
    scanForMigrations(migrations, configuration.getSqlMigrationPrefix(), configuration.getSqlMigrationSeparator(), configuration.getSqlMigrationSuffix());
    scanForMigrations(migrations, configuration.getRepeatableSqlMigrationPrefix(), configuration.getSqlMigrationSeparator(), configuration.getSqlMigrationSuffix());
    Collections.sort(migrations, new ResolvedMigrationComparator());
    return migrations;
}
Also used : ResolvedMigrationComparator(org.flywaydb.core.internal.resolver.ResolvedMigrationComparator) ArrayList(java.util.ArrayList) ResolvedMigration(org.flywaydb.core.api.resolver.ResolvedMigration)

Example 7 with ResolvedMigrationComparator

use of org.flywaydb.core.internal.resolver.ResolvedMigrationComparator 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)

Example 8 with ResolvedMigrationComparator

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

the class SqlMigrationResolver method resolveMigrations.

public List<ResolvedMigration> resolveMigrations(Context context) {
    List<ResolvedMigration> migrations = new ArrayList<>();
    String[] suffixes = configuration.getSqlMigrationSuffixes();
    addMigrations(migrations, configuration.getSqlMigrationPrefix(), suffixes, false);
    addMigrations(migrations, configuration.getRepeatableSqlMigrationPrefix(), suffixes, true);
    migrations.sort(new ResolvedMigrationComparator());
    return migrations;
}
Also used : ResolvedMigrationComparator(org.flywaydb.core.internal.resolver.ResolvedMigrationComparator) ArrayList(java.util.ArrayList) ResolvedMigration(org.flywaydb.core.api.resolver.ResolvedMigration)

Aggregations

ArrayList (java.util.ArrayList)8 ResolvedMigration (org.flywaydb.core.api.resolver.ResolvedMigration)8 ResolvedMigrationComparator (org.flywaydb.core.internal.resolver.ResolvedMigrationComparator)8 ResolvedMigrationImpl (org.flywaydb.core.internal.resolver.ResolvedMigrationImpl)4 FlywayException (org.flywaydb.core.api.FlywayException)2 JavaMigration (org.flywaydb.core.api.migration.JavaMigration)2 JdbcMigration (org.flywaydb.core.api.migration.jdbc.JdbcMigration)1 SpringJdbcMigration (org.flywaydb.core.api.migration.spring.SpringJdbcMigration)1 Resource (org.flywaydb.core.internal.util.scanner.Resource)1