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

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

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

Flyway.setBaselineOnMigrate介绍

暂无

代码示例

代码示例来源:origin: rakam-io/rakam

@Inject
  public FlywayExecutor(@Named("report.metadata.store.jdbc") JDBCPoolDataSource config) {
    Flyway flyway = new Flyway();
    flyway.setBaselineOnMigrate(true);
    flyway.setDataSource(config);
    flyway.setLocations("db/migration/report");
    flyway.setTable("schema_version_report");
    try {
      flyway.migrate();
    } catch (FlywayException e) {
      flyway.repair();
    }
  }
}

代码示例来源:origin: rakam-io/rakam

@Inject
  public FlywayExecutor(@Named("ui.metadata.jdbc") JDBCConfig config) {
    Flyway flyway = new Flyway();
    flyway.setBaselineOnMigrate(true);
    flyway.setLocations("db/migration/ui");
    flyway.setTable("schema_version_ui");
    flyway.setDataSource(config.getUrl(), config.getUsername(), config.getPassword());
    try {
      flyway.migrate();
    } catch (FlywayException e) {
      flyway.repair();
    }
  }
}

代码示例来源:origin: de.digitalcollections.cudami/dc-cudami-server-backend-jdbi

@Bean(initMethod = "migrate")
@Autowired
@Qualifier(value = "pds")
public Flyway flyway(DataSource pds) {
 Flyway flyway = new Flyway();
 flyway.setDataSource(pds); // could be another datasource with different user/pwd...
 flyway.setLocations("classpath:/de/digitalcollections/cudami/server/backend/impl/database/migration");
 flyway.setBaselineOnMigrate(true);
 return flyway;
}

代码示例来源:origin: com.centit.framework/centit-persistence-config

@Bean
public Flyway flyway(DataSource dataSource) {
  String flywayEnable = env.getProperty("flyway.enable");
  if(StringRegularOpt.isTrue(flywayEnable)){
    Flyway flywayMigration = new Flyway();
    flywayMigration.setDataSource(dataSource);
    flywayMigration.setBaselineOnMigrate(true);
    flywayMigration.setLocations(env.getProperty("flyway.sql.dir"), "com.centit.framework.system.update");
    flywayMigration.migrate();
    return flywayMigration;
  }else{
    return null;
  }
}

代码示例来源:origin: org.nuiton.topia/topia-service-flyway

log.debug("schema exists, will ask flyway to init if necessary to version " + flywayBaselineVersion);
flyway.setBaselineOnMigrate(true);
flyway.setBaselineVersion(MigrationVersion.fromVersion(flywayBaselineVersion));

代码示例来源:origin: org.openl.rules/org.openl.rules.security.standalone

flyway.setDataSource(dataSource);
flyway.setBaselineVersionAsString("0");
flyway.setBaselineOnMigrate(true);
flyway.setTable("openl_security_flyway");
flyway.setPlaceholders(placeholders);

代码示例来源:origin: org.openl.rules/org.openl.security.standalone

flyway.setDataSource(dataSource);
flyway.setBaselineVersionAsString("0");
flyway.setBaselineOnMigrate(true);
flyway.setTable("openl_security_flyway");
flyway.setPlaceholders(placeholders);

代码示例来源:origin: openl-tablets/openl-tablets

flyway.setDataSource(dataSource);
flyway.setBaselineVersionAsString("0");
flyway.setBaselineOnMigrate(true);
flyway.setTable("openl_security_flyway");
flyway.setPlaceholders(placeholders);

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

@Override
public void start(FlywayMigration component) {
  DataSourceComponent dataSourceComponent = getDependency(DataSourceComponent.class);
  DataSource dataSource = dataSourceComponent.getDataSource();
  component.flyway = new Flyway(Thread.currentThread().getContextClassLoader());
  component.flyway.setTable(table);
  component.flyway.setBaselineOnMigrate(true);
  component.flyway.setBaselineVersionAsString("0");
  component.flyway.setDataSource(dataSource);
  if (component.locations != null) {
    component.flyway.setLocations(component.locations);
  }
  if (isMigrationAvailable()) {
    component.flyway.migrate();
  }
}

代码示例来源:origin: icode/ameba

Flyway flyway = new Flyway();
flyway.setDataSource(DataSourceManager.getDataSource(dbName));
flyway.setBaselineOnMigrate(true);
bindFlyway(dbName, flyway);
Migration migration = locator.getService(Migration.class, dbName);

代码示例来源: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: mbok/logsniffer

logger.info("H2 database not found, creating new schema and populate with default data");
flyway.setBaselineVersion(MigrationVersion.fromVersion(DB_SETUP_VERSION));
flyway.setBaselineOnMigrate(true);
try {
  final ResourceDatabasePopulator dbPopulator = new ResourceDatabasePopulator();
  logger.info("Flyway's DB migration not setup in this version, set baseline version to 0.5.0");
  flyway.setBaselineVersion(MigrationVersion.fromVersion("0.5.0"));
  flyway.setBaselineOnMigrate(true);

代码示例来源:origin: vladmihalcea/high-performance-java-persistence

@Bean(initMethod = "migrate")
public Flyway flyway() {
  Flyway flyway = new Flyway();
  flyway.setDataSource(actualDataSource());
  flyway.setBaselineOnMigrate(true);
  flyway.setLocations(String.format("classpath:/flyway/db/%1$s/migration", databaseType()));
  return flyway;
}

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

public static void migrate() {
  Flyway flyway = new Flyway();
  flyway.setDataSource(CMSConnectionPools.processing());
  flyway.setBaselineOnMigrate(true);
  flyway.setLocations("db/cms/migration");
  flyway.setSqlMigrationPrefix("V_");
  flyway.setTable("_flyway");
  flyway.migrate();
}

代码示例来源:origin: mycontroller-org/mycontroller

AppProperties.getInstance().getDbUsername(), AppProperties.getInstance().getDbPassword());
flyway.setLocations(DB_MIGRATION_SCRIPT_LOCATION);
flyway.setBaselineOnMigrate(true);

代码示例来源:origin: org.mycontroller.standalone/mycontroller-core

AppProperties.getInstance().getDbUsername(), AppProperties.getInstance().getDbPassword());
flyway.setLocations(DB_MIGRATION_SCRIPT_LOCATION);
flyway.setBaselineOnMigrate(true);

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

public static Flyway get(StorageProviderConfiguration conf, String scriptRootPath, boolean validateOnMigrate) {
  Flyway flyway = new Flyway();
  String location = "filesystem:" + scriptRootPath + File.separator + conf.getDbType();
  flyway.setEncoding(encoding);
  flyway.setTable(metaDataTableName);
  flyway.setSqlMigrationPrefix(sqlMigrationPrefix);
  flyway.setValidateOnMigrate(validateOnMigrate);
  flyway.setOutOfOrder(outOfOrder);
  flyway.setBaselineOnMigrate(baselineOnMigrate);
  flyway.setBaselineVersion(MigrationVersion.fromVersion(baselineVersion));
  flyway.setCleanOnValidationError(cleanOnValidationError);
  flyway.setLocations(location);
  flyway.setDataSource(conf.getUrl(), conf.getUser(), conf.getPassword(), null);
  return flyway;
}

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

public static Flyway get(StorageProviderConfiguration conf, String scriptRootPath, boolean validateOnMigrate) {
  Flyway flyway = new Flyway();
  String location = "filesystem:" + scriptRootPath + File.separator + conf.getDbType();
  flyway.setEncoding(encoding);
  flyway.setTable(metaDataTableName);
  flyway.setSqlMigrationPrefix(sqlMigrationPrefix);
  flyway.setValidateOnMigrate(validateOnMigrate);
  flyway.setOutOfOrder(outOfOrder);
  flyway.setBaselineOnMigrate(baselineOnMigrate);
  flyway.setBaselineVersion(MigrationVersion.fromVersion(baselineVersion));
  flyway.setCleanOnValidationError(cleanOnValidationError);
  flyway.setLocations(location);
  flyway.setDataSource(conf.getUrl(), conf.getUser(), conf.getPassword(), null);
  return flyway;
}

代码示例来源: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;
}

相关文章