com.googlecode.flyway.core.Flyway.setInitVersion()方法的使用及代码示例

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

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

Flyway.setInitVersion介绍

[英]Sets the version to tag an existing schema with when executing init.
[中]设置在执行init时标记现有架构的版本。

代码示例

代码示例来源:origin: com.googlecode.flyway/flyway-core

setInitVersion(new MigrationVersion(initVersionProp));

代码示例来源:origin: org.jabylon/db.migration

private void migrateDB(DataSource dataSource)
{
  boolean dbExists = dbExists(dataSource);
  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setTable("SCHEMA_VERSION");
  // flyway.setInitOnMigrate(true);
  if (!dbExists)
  {
    MigrationVersion migrationVersion = getLatestVersion(flyway);
    if (migrationVersion != null)
      flyway.setInitVersion(migrationVersion);
  }
  MigrationInfo current = flyway.info().current();
  if (current == null)
    flyway.init();
  flyway.migrate();
}

代码示例来源:origin: com.googlecode.flyway/flyway-ant

flyway.setInitVersion(initVersionValue);

代码示例来源:origin: jvelo/mayocat-shop

@Override
  protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception
  {
    final DataSourceFactory dbConfig = strategy.getDataSourceFactory(configuration);

    dbConfig.setMaxSize(1);
    dbConfig.setMinSize(1);

    Flyway flyway = new Flyway();
    flyway.setLocations(MAYOAPP_MIGRATIONS);
    flyway.setDataSource(dbConfig.getUrl(), dbConfig.getUser(), dbConfig.getPassword());
    if (flyway.info().current() == null) {
      flyway.setInitVersion("0000.0001");
      flyway.init();
    }
    flyway.migrate();
  }
}

相关文章