private boolean isMigrationAvailable() { return Arrays.stream(flyway.getConfiguration().getLocations()) .anyMatch(l-> { if (l.isClassPath()) { return Thread.currentThread().getContextClassLoader().getResource(l.getPath()) != null; } else if (l.isFileSystem()){ return Files.exists(Paths.get(l.getPath())); } else throw new UnreachableException(); }); }
/** * Creates a new instance. * * @param configuration Flyway configuration. * @param location The location on the classpath where to migrations are located. * @param shellMigrationPrefix The prefix for shell migrations * @param shellMigrationSeparator The separator for shell migrations * @param shellMigrationSuffix The suffix for shell migrations */ public ShellMigrationResolver(Configuration configuration, String location, String shellMigrationPrefix, String shellMigrationSeparator, String shellMigrationSuffix) { this.scanner = new Scanner(configuration); this.location = new Location(location); this.shellMigrationPrefix = shellMigrationPrefix; this.shellMigrationSeparator = shellMigrationSeparator; this.shellMigrationSuffix = shellMigrationSuffix; }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }
/** * Extracts the script name from this resource. * * @param resource The resource to process. * @return The script name. */ /* private -> for testing */ String extractScriptName(Resource resource) { if (location.getPath().isEmpty()) { return resource.getLocation(); } return resource.getLocation().substring(location.getPath().length() + 1); }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }
/** * Extracts the script name from this resource. * * @param resource The resource to process. * @return The script name. */ /* private -> for testing */ String extractScriptName(Resource resource) { if (location.getPath().isEmpty()) { return resource.getLocation(); } return resource.getLocation().substring(location.getPath().length() + 1); }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }
/** * Creates a new instance. * * @param configuration Flyway configuration. * @param location The location on the classpath where to migrations are located. * @param shellMigrationPrefix The prefix for shell migrations * @param shellMigrationSeparator The separator for shell migrations * @param shellMigrationSuffix The suffix for shell migrations */ public ShellMigrationResolver(Configuration configuration, String location, String shellMigrationPrefix, String shellMigrationSeparator, String shellMigrationSuffix) { this.scanner = new Scanner(configuration); this.location = new Location(location); this.shellMigrationPrefix = shellMigrationPrefix; this.shellMigrationSeparator = shellMigrationSeparator; this.shellMigrationSuffix = shellMigrationSuffix; }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }
private String[] convertLocationToString(Flyway flyWay) { Location[] locations = flyWay.getConfiguration().getLocations(); String [] stringLocations = new String[locations.length]; for (int i = 0; i < locations.length; i++) { stringLocations[i] = locations[i].getDescriptor(); } return stringLocations; }