org.flywaydb.core.Flyway.getConfiguration()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.flywaydb.core.Flyway.getConfiguration()方法的一些代码示例,展示了Flyway.getConfiguration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flyway.getConfiguration()方法的具体详情如下:
包路径:org.flywaydb.core.Flyway
类名称:Flyway
方法名:getConfiguration

Flyway.getConfiguration介绍

暂无

代码示例

代码示例来源:origin: flyway/flyway-test-extensions

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;
}

代码示例来源:origin: flyway/flyway-test-extensions

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;
}

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring5-test

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;
}

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring-test

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;
}

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring3-test

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;
}

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring4-test

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;
}

代码示例来源:origin: flyway/flyway-test-extensions

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;
}

代码示例来源:origin: flyway/flyway-test-extensions

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;
}

代码示例来源:origin: kawasima/enkan

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();
      });
}

代码示例来源:origin: theotherp/nzbhydra2

@Override
  public void migrate(Flyway flyway) {
    try {
      flyway.migrate();
    } catch (FlywayException e) {
      if (e.getMessage().contains("1.15")) {
        logger.info("Found failed database migration. Attempting repair");
        flyway.repair();
        try {
          flyway.getConfiguration().getDataSource().getConnection().createStatement().executeUpdate("delete from PUBLIC.\"schema_version\" where \"version\" = '1.15' or \"version\" = '1.16'");
        } catch (SQLException e1) {
          logger.error("Error while deleting old migration steps", e);
        }
        flyway.migrate();
      } else {
        logger.error("Unable to migrate", e);
        throw e;
      }
    }
  }
};

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring-test

fluentConfiguration.configuration(flyWay.getConfiguration())
.locations(useLocations)
.load()

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring5-test

fluentConfiguration.configuration(flyWay.getConfiguration())
.locations(useLocations)
.load()

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring4-test

fluentConfiguration.configuration(flyWay.getConfiguration())
.locations(useLocations)
.load()

代码示例来源:origin: flyway/flyway-test-extensions

fluentConfiguration.configuration(flyWay.getConfiguration())
.locations(useLocations)
.load()

代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring3-test

fluentConfiguration.configuration(flyWay.getConfiguration())
.locations(useLocations)
.load()

代码示例来源:origin: dropwizard/dropwizard-flyway

@Override
  protected void run(final Namespace namespace, final Flyway flyway) throws Exception {
    final Boolean namespaceBoolean = namespace.getBoolean(OUT_OF_ORDER);
    final Boolean cleanOnValidationError = namespace.getBoolean(CLEAN_ON_VALIDATION_ERROR);

    FluentConfiguration config = Flyway.configure(flyway.getConfiguration().getClassLoader()).configuration(flyway.getConfiguration());
    
    if (namespaceBoolean != null) {
      config.outOfOrder(namespaceBoolean);
    }

    if (cleanOnValidationError != null) {
      config.cleanOnValidationError(cleanOnValidationError);
    }

    Flyway customFlyway = config.load();
    
    customFlyway.validate();
  }
}

代码示例来源:origin: dropwizard/dropwizard-flyway

final Boolean baselineOnMigrate = namespace.getBoolean(INIT_ON_MIGRATE);
FluentConfiguration config = Flyway.configure(flyway.getConfiguration().getClassLoader()).configuration(flyway.getConfiguration());

代码示例来源:origin: org.flywaydb/flyway-gradle-plugin

@SuppressWarnings("unused")
@TaskAction
public Object runTask() {
  try {
    Map<String, String> envVars = ConfigUtils.environmentVariablesToPropertyMap();
    Set<URL> extraURLs = new HashSet<>();
    if (isJavaProject()) {
      addClassesAndResourcesDirs(extraURLs);
      addConfigurationArtifacts(determineConfigurations(envVars), extraURLs);
    }
    ClassLoader classLoader = new URLClassLoader(
        extraURLs.toArray(new URL[0]),
        getProject().getBuildscript().getClassLoader());
    Flyway flyway = Flyway.configure(classLoader).configuration(createFlywayConfig(envVars)).load();
    Object result = run(flyway);
    ((DriverDataSource) flyway.getConfiguration().getDataSource()).shutdownDatabase();
    return result;
  } catch (Exception e) {
    throw new FlywayException(collectMessages(e, "Error occurred while executing " + getName()), e);
  }
}

代码示例来源:origin: com.hortonworks.registries/storage-tool

public static Flyway get(StorageProviderConfiguration conf, String scriptRootPath) {
  Flyway flyway = new Flyway();
  String location = "filesystem:" + scriptRootPath;
  flyway.setEncoding(encoding);
  flyway.setTable(metaDataTableName);
  flyway.setValidateOnMigrate(validateOnMigrate);
  flyway.setOutOfOrder(outOfOrder);
  flyway.setBaselineOnMigrate(baselineOnMigrate);
  flyway.setBaselineVersion(MigrationVersion.fromVersion(baselineVersion));
  flyway.setCleanOnValidationError(cleanOnValidationError);
  flyway.setLocations(location);
  flyway.setResolvers(new ShellMigrationResolver(flyway.getConfiguration(), location, shellMigrationPrefix, shellMigrationSeperator, shellMigrationSuffix));
  flyway.setDataSource(conf.getUrl(), conf.getUser(), conf.getPassword(), null);
  return flyway;
}

代码示例来源:origin: hortonworks/registry

public static Flyway get(StorageProviderConfiguration conf, String scriptRootPath) {
  Flyway flyway = new Flyway();
  String location = "filesystem:" + scriptRootPath;
  flyway.setEncoding(encoding);
  flyway.setTable(metaDataTableName);
  flyway.setValidateOnMigrate(validateOnMigrate);
  flyway.setOutOfOrder(outOfOrder);
  flyway.setBaselineOnMigrate(baselineOnMigrate);
  flyway.setBaselineVersion(MigrationVersion.fromVersion(baselineVersion));
  flyway.setCleanOnValidationError(cleanOnValidationError);
  flyway.setLocations(location);
  flyway.setResolvers(new ShellMigrationResolver(flyway.getConfiguration(), location, shellMigrationPrefix, shellMigrationSeperator, shellMigrationSuffix));
  flyway.setDataSource(conf.getUrl(), conf.getUser(), conf.getPassword(), null);
  return flyway;
}

相关文章