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

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

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

Flyway.setSchemas介绍

暂无

代码示例

代码示例来源:origin: jdbi/jdbi

@Override
public void after() {
  if (migration != null && migration.cleanAfter) {
    final Flyway flyway = new Flyway();
    flyway.setDataSource(getDataSource());
    flyway.setLocations(migration.paths.toArray(new String[0]));
    flyway.setSchemas(migration.schemas.toArray(new String[0]));
    flyway.clean();
  }
  handle.close();
  jdbi = null;
  dataSource = null;
}

代码示例来源:origin: jdbi/jdbi

@Override
public void before() throws Throwable {
  if (migration != null) {
    final Flyway flyway = new Flyway();
    flyway.setDataSource(getDataSource());
    flyway.setLocations(migration.paths.toArray(new String[0]));
    flyway.setSchemas(migration.schemas.toArray(new String[0]));
    flyway.migrate();
  }
  jdbi = Jdbi.create(getDataSource());
  if (installPlugins) {
    jdbi.installPlugins();
  }
  plugins.forEach(jdbi::installPlugin);
  handle = jdbi.open();
}

代码示例来源:origin: zapodot/embedded-db-junit

public Builder withSchemas(final String... schemas) {
  flyway.setSchemas(schemas);
  return this;
}

代码示例来源:origin: exomiser/Exomiser

private void migrateDatabase(DataSource dataSource) {
    Map<String, String> propertyPlaceHolders = new HashMap<>();
    propertyPlaceHolders.put("import.path", dataPath.toString());

    logger.info("Migrating {} genome database...", buildString);
    Flyway h2Flyway = new Flyway();
    h2Flyway.setDataSource(dataSource);
    h2Flyway.setSchemas("EXOMISER");
    h2Flyway.setLocations("classpath:db/migration");
    h2Flyway.setPlaceholders(propertyPlaceHolders);
    h2Flyway.clean();
    h2Flyway.migrate();
  }
}

代码示例来源:origin: com.crosstreelabs/junited.flyway

@Override
protected void before(Statement statement, Description description) throws Throwable {
  if (datasource == null) {
    datasource = provider.get();
  }
  if (schema == null || database == null) {
    try (Connection conn = datasource.getConnection()) {
      schema = conn.getSchema();
      database = conn.getMetaData().getDatabaseProductName();
    } catch (SQLException ex) {
      throw new RuntimeException(ex);
    }
  }
  Flyway flyway = new Flyway();
  flyway.setClassLoader(new FlywayClassLoader(FlywayRule.class.getClassLoader(), database));
  flyway.setDataSource(datasource);
  flyway.setSchemas(schema);
  flyway.setSqlMigrationPrefix("");
  flyway.setOutOfOrder(true);
  flyway.migrate();
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean(initMethod = "migrate")
public Flyway flyway(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  return flyway;
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean(initMethod = "migrate")
public Flyway flyway(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test", "unique");
  return flyway;
}

代码示例来源:origin: exomiser/Exomiser

private static void migrateH2Database(DataSource h2DataSource, Map<String, String> propertyPlaceHolders) {
    logger.info("Migrating exomiser H2 database...");
    Flyway h2Flyway = new Flyway();
    h2Flyway.setDataSource(h2DataSource);
    h2Flyway.setSchemas("EXOMISER");
    h2Flyway.setLocations("migration/common", "migration/h2");
    h2Flyway.setPlaceholders(propertyPlaceHolders);
    h2Flyway.clean();
    h2Flyway.migrate();
  }
}

代码示例来源:origin: org.arquillian.ape/arquillian-ape-sql-standalone-flyway

flyway.setSchemas((String[]) this.options.get(SCHEMAS));

代码示例来源:origin: novarto-oss/sane-dbc

@BeforeClass
public static void setup()
{
  // set schema name
  FLYWAY.setSchemas("FLYWAY");
  // set datasource
  FLYWAY.setDataSource(FLYWAY_JDBC_URL, "sa", "");
  // set location folders which contain migrations that needs to be applied by flyway
  final String packageName = FlywayMigrationExample.class.getPackage().getName();
  final String packageFolder = packageName.replace(".", "/");
  final String migrationFolder = packageFolder + "/flyway";
  final List<String> migrationFolders = new ArrayList<>();
  migrationFolders.add(migrationFolder);
  migrationFolders.add("flyway");
  FLYWAY.setLocations(migrationFolders.toArray(new String[migrationFolders.size()]));
  // run migrations
  FLYWAY.migrate();
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean
public Flyway flyway(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  flyway.setLocations("db/migration", "db/test_migration/slow");
  return flyway;
}

代码示例来源:origin: org.zalando/nakadi-producer-spring-boot-starter

@PostConstruct
public void migrateFlyway() {
  Flyway flyway = new Flyway();
  if (this.nakadiProducerFlywayDataSource != null) {
    flyway.setDataSource(nakadiProducerFlywayDataSource);
  } else if (this.flywayProperties != null && this.flywayProperties.isCreateDataSource()) {
    flyway.setDataSource(
        Optional.ofNullable(this.flywayProperties.getUrl()).orElse(dataSourceProperties.getUrl()),
        Optional.ofNullable(this.flywayProperties.getUser()).orElse(dataSourceProperties.getUsername()),
        Optional.ofNullable(this.flywayProperties.getPassword()).orElse(dataSourceProperties.getPassword()),
        this.flywayProperties.getInitSqls().toArray(new String[0]));
  } else if (this.flywayDataSource != null) {
    flyway.setDataSource(this.flywayDataSource);
  } else {
    flyway.setDataSource(dataSource);
  }
  flyway.setLocations("classpath:db_nakadiproducer/migrations");
  flyway.setSchemas("nakadi_events");
  if (callbacks != null) {
    flyway.setCallbacks(callbacks.stream().map(FlywayCallbackAdapter::new).toArray(FlywayCallback[]::new));
  }
  flyway.setBaselineOnMigrate(true);
  flyway.setBaselineVersionAsString("2133546886.1.0");
  flyway.migrate();
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean
public Flyway flyway1(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  flyway.setLocations("db/migration", "db/test_migration/dependent");
  return flyway;
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean
public Flyway flyway1(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  flyway.setLocations("db/migration", "db/test_migration/dependent");
  return flyway;
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean
public Flyway flyway2(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  flyway.setLocations("db/test_migration/separated");
  return flyway;
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean
public Flyway flyway2(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  flyway.setLocations("db/test_migration/separated");
  return flyway;
}

代码示例来源:origin: org.spincast/spincast-plugins-flyway-utils

protected Flyway createFlyway() {
  Flyway flyway = new Flyway();
  flyway.setDataSource(getDataSource());
  String schema = getSchema();
  if (schema != null) {
    flyway.setSchemas(schema);
  }
  flyway.setResolvers(SpincastFlywayMigrationContextDefault.this);
  flyway.setSkipDefaultResolvers(true);
  flyway.setSkipDefaultCallbacks(true);
  return flyway;
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean
public Flyway flyway3(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  flyway.setLocations("db/test_migration/appendable");
  flyway.setValidateOnMigrate(false);
  return flyway;
}

代码示例来源:origin: zonkyio/embedded-database-spring-test

@Bean
public Flyway flyway3(DataSource dataSource) {
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setSchemas("test");
  flyway.setLocations("db/test_migration/appendable");
  flyway.setValidateOnMigrate(false);
  return flyway;
}

代码示例来源:origin: CoinbaseWallet/toshi-headless-client

flyway.setDataSource(pgconfig.getJdbcUrl(), pgconfig.getUsername(), pgconfig.getPassword());
flyway.setLocations("db/migration/psql");
flyway.setSchemas(schema);
flyway.migrate();
schemas.remove(0);

相关文章