public Set<Migration> resolve(DatabaseType dbType) { Set<Migration> migrations = new HashSet<Migration>(); // Find all resources in the migrations location. File path = new File(Play.applicationPath, migrationsLocation); List<Resource> resources = new ArrayList<Resource>(); Collection<File> files = FileUtils.listFiles(path, new String[] {"sql"}, true); for (File file : files) { resources.add(new Resource(file)); } if (resources.isEmpty()) { String message = "No migrations were found from path '" + path.getAbsolutePath() + "'."; logger.error(message); throw new MigrationException(message); } if (logger.isDebugEnabled()) { logger.debug("Found " + resources.size() + " resources: " + resources); } // Extract versions and create executable migrations for each resource. for (Resource resource : resources) { String version = versionExtractor.extractVersion(resource.getFilename()); if (find(migrations, new Migration.MigrationVersionPredicate(version)) != null) { String message = "Non-unique migration version."; logger.error(message); throw new MigrationException(message); } migrations.add(migrationFactory.create(version, resource)); } return migrations; }