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

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

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

Flyway.info介绍

[英]Retrieves the complete information about all the migrations including applied, pending and current migrations with details and status.
[中]检索有关所有迁移的完整信息,包括已应用、挂起和当前迁移的详细信息和状态。

代码示例

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

private MigrationVersion getLatestVersion(Flyway flyway)
{
  MigrationInfo[] pending = flyway.info().pending();
  if (pending == null || pending.length == 0)
    return null;
  return pending[pending.length - 1].getVersion();
}

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

/**
 * Returns the history (all applied migrations) of the database.
 *
 * @return All migrations applied to the database, sorted, oldest first. An empty list if none.
 * @deprecated Use flyway.info().applied() instead. Will be removed in Flyway 3.0.
 */
@Deprecated
public List<MetaDataTableRow> history() {
  LOG.warn("Flyway.history() has been deprecated and will be removed in Flyway 3.0. Use Flyway.info().applied() instead.");
  MigrationInfo[] migrationInfos = info().applied();
  List<MetaDataTableRow> metaDataTableRows = new ArrayList<MetaDataTableRow>();
  for (MigrationInfo migrationInfo : migrationInfos) {
    metaDataTableRows.add(new MetaDataTableRow(migrationInfo));
  }
  return metaDataTableRows;
}

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

/**
 * Returns the status (current version) of the database.
 *
 * @return The latest applied migration, or {@code null} if no migration has been applied yet.
 * @deprecated Use flyway.info().current() instead. Will be removed in Flyway 3.0.
 */
@Deprecated
public MetaDataTableRow status() {
  LOG.warn("Flyway.status() has been deprecated and will be removed in Flyway 3.0. Use Flyway.info().current() instead.");
  MigrationInfo current = info().current();
  if (current == null) {
    return null;
  }
  return new MetaDataTableRow(current);
}

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

@Override
  protected void doExecuteWithMigrationConfig(Flyway flyway) throws Exception {
    log.info("\n" + MigrationInfoDumper.dumpToAsciiTable(flyway.info().all()));
  }
}

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

@Override
  protected void doExecuteWithMigrationConfig(Flyway flyway) throws Exception {
    log.warn("<flyway:history/> is deprecated. Use <flyway:info/> instead.");
    log.info("\n" + MigrationInfoDumper.dumpToAsciiTable(flyway.info().applied()));
  }
}

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

} else if ("status".equals(operation)) {
  LOG.warn("status is deprecated. Use info instead.");
  MigrationInfo current = flyway.info().current();
  LOG.info("\n" + MigrationInfoDumper.dumpToAsciiTable(flyway.info().applied(), consoleWidth));
} else if ("info".equals(operation)) {
  LOG.info("\n" + MigrationInfoDumper.dumpToAsciiTable(flyway.info().all(), consoleWidth));
} else if ("repair".equals(operation)) {
  flyway.repair();

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

@Override
  protected void doExecuteWithMigrationConfig(Flyway flyway) throws Exception {
    log.warn("<flyway:status/> is deprecated. Use <flyway:info/> instead.");
    MigrationInfo current = flyway.info().current();

    if (current == null) {
      log.info("\n" + MigrationInfoDumper.dumpToAsciiTable(new MigrationInfo[0]));
    } else {
      log.info("\n" + MigrationInfoDumper.dumpToAsciiTable(new MigrationInfo[]{current}));
    }
  }
}

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

@Override
  protected void doExecuteWithMigrationConfig(Flyway flyway) throws Exception {
    String validationModeValue = useValueIfPropertyNotSet(validationMode, "validationMode");
    if (validationModeValue != null) {
      flyway.setValidationMode(ValidationMode.valueOf(validationModeValue.toUpperCase()));
    }
    flyway.setValidateOnMigrate(useValueIfPropertyNotSet(validateOnMigrate, "validateOnMigrate"));
    flyway.setDisableInitCheck(useValueIfPropertyNotSet(disableInitCheck, "disableInitCheck"));
    flyway.setInitOnMigrate(useValueIfPropertyNotSet(initOnMigrate, "initOnMigrate"));
    flyway.setIgnoreFailedFutureMigration(useValueIfPropertyNotSet(ignoreFailedFutureMigration, "ignoreFailedFutureMigration"));

    if (flyway.info().all().length == 0) {
      log.warn("Possible solution: run the Ant javac and copy tasks first so Flyway can find the migrations");
      return;
    }

    flyway.migrate();
  }
}

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

相关文章