private boolean readResourcesForPath(String path) { ClassLoader classLoader = migrationConfig.getClassLoader(); Scanner scanner = new Scanner(classLoader); List<Resource> resourceList = scanner.scanForResources(path, new Match(migrationConfig)); logger.debug("resources: {}", resourceList); for (Resource resource : resourceList) { String filename = resource.getFilename(); if (filename.endsWith(migrationConfig.getApplySuffix())) { versions.add(createScriptMigration(resource, filename)); } else if (migrationConfig.getJdbcMigrationFactory() != null && filename.endsWith(".class")) { versions.add(createJdbcMigration(resource, filename)); } } Collections.sort(versions); return !versions.isEmpty(); }
/** * Read all the migration resources (SQL scripts) returning true if there are versions. */ public boolean readResources() { String migrationPath = migrationConfig.getMigrationPath(); ClassLoader classLoader = migrationConfig.getClassLoader(); Scanner scanner = new Scanner(classLoader); List<Resource> resourceList = scanner.scanForResources(migrationPath, new Match(migrationConfig)); logger.debug("resources: {}", resourceList); for (Resource resource : resourceList) { String filename = resource.getFilename(); if (filename.endsWith(migrationConfig.getApplySuffix())) { int pos = filename.lastIndexOf(migrationConfig.getApplySuffix()); String mainName = filename.substring(0, pos); MigrationVersion migrationVersion = MigrationVersion.parse(mainName); LocalMigrationResource res = new LocalMigrationResource(migrationVersion, resource.getLocation(), resource); versions.add(res); } } Collections.sort(versions); return !versions.isEmpty(); }
/** * Read all the migration resources (SQL scripts) returning true if there are versions. */ public boolean readResources() { String migrationPath = migrationConfig.getMigrationPath(); ClassLoader classLoader = migrationConfig.getClassLoader(); Scanner scanner = new Scanner(classLoader); List<Resource> resourceList = scanner.scanForResources(migrationPath, new Match(migrationConfig)); logger.debug("resources: {}", resourceList); for (Resource resource : resourceList) { String filename = resource.getFilename(); if (filename.endsWith(migrationConfig.getApplySuffix())) { int pos = filename.lastIndexOf(migrationConfig.getApplySuffix()); String mainName = filename.substring(0, pos); MigrationVersion migrationVersion = MigrationVersion.parse(mainName); LocalMigrationResource res = new LocalMigrationResource(migrationVersion, resource.getLocation(), resource); versions.add(res); } } Collections.sort(versions); return !versions.isEmpty(); }