Search in sources :

Example 11 with Location

use of org.flywaydb.core.api.Location in project flyway by flyway.

the class Locations method processLocations.

private void processLocations(List<Location> rawLocations) {
    List<Location> sortedLocations = new ArrayList<>(rawLocations);
    Collections.sort(sortedLocations);
    for (Location normalizedLocation : sortedLocations) {
        if (locations.contains(normalizedLocation)) {
            LOG.warn("Discarding duplicate location '" + normalizedLocation + "'");
            continue;
        }
        Location parentLocation = getParentLocationIfExists(normalizedLocation, locations);
        if (parentLocation != null) {
            LOG.warn("Discarding location '" + normalizedLocation + "' as it is a sub-location of '" + parentLocation + "'");
            continue;
        }
        locations.add(normalizedLocation);
    }
}
Also used : ArrayList(java.util.ArrayList) Location(org.flywaydb.core.api.Location)

Aggregations

Location (org.flywaydb.core.api.Location)11 Flyway (org.flywaydb.core.Flyway)8 Test (org.junit.jupiter.api.Test)8 DataSourceAutoConfiguration (org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration)3 ArrayList (java.util.ArrayList)2 ClassicConfiguration (org.flywaydb.core.api.configuration.ClassicConfiguration)1 LoadableResource (org.flywaydb.core.api.resource.LoadableResource)1 ClassPathScanner (org.flywaydb.core.internal.scanner.classpath.ClassPathScanner)1 EmbeddedDataSourceConfiguration (org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration)1 Bean (org.springframework.context.annotation.Bean)1 DependsOn (org.springframework.context.annotation.DependsOn)1 Profile (org.springframework.context.annotation.Profile)1