use of org.flywaydb.core.api.callback.Event in project flyway by flyway.
the class ResourceNameParser method populatePrefixes.
private List<Pair<String, ResourceType>> populatePrefixes(Configuration configuration) {
List<Pair<String, ResourceType>> prefixes = new ArrayList<>();
prefixes.add(Pair.of(configuration.getSqlMigrationPrefix(), ResourceType.MIGRATION));
prefixes.add(Pair.of(configuration.getRepeatableSqlMigrationPrefix(), ResourceType.REPEATABLE_MIGRATION));
for (Event event : Event.values()) {
prefixes.add(Pair.of(event.getId(), ResourceType.CALLBACK));
}
Comparator<Pair<String, ResourceType>> prefixComparator = (p1, p2) -> {
// Sort most-hard-to-match first; that is, in descending order of prefix length
return p2.getLeft().length() - p1.getLeft().length();
};
prefixes.sort(prefixComparator);
return prefixes;
}
Aggregations