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

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

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

Flyway.setIgnoreFailedFutureMigration介绍

[英]Ignores failed future migrations when reading the metadata table. These are migrations that were performed by a newer deployment of the application that are not yet available in this version. For example: we have migrations available on the classpath up to version 3.0. The metadata table indicates that a migration to version 4.0 (unknown to us) has already been attempted and failed. Instead of bombing out (fail fast) with an exception, a warning is logged and Flyway terminates normally. This is useful for situations where a database rollback is not an option. An older version of the application can then be redeployed, even though a newer one failed due to a bad migration.
[中]读取元数据表时忽略失败的未来迁移。这些迁移是由较新的应用程序部署执行的,但在此版本中尚不可用。例如:我们在3.0版之前的类路径上提供了迁移。元数据表表明已尝试迁移到版本4.0(我们不知道),但失败。除了在异常情况下爆炸(快速失效)外,还记录了一条警告,Flyway正常终止。这对于不选择数据库回滚的情况非常有用。然后可以重新部署较旧版本的应用程序,即使较新版本由于错误迁移而失败。

代码示例

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

setIgnoreFailedFutureMigration(Boolean.parseBoolean(ignoreFailedFutureMigrationProp));

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

相关文章