本文整理了Java中com.googlecode.flyway.core.Flyway.setInitOnMigrate()
方法的一些代码示例,展示了Flyway.setInitOnMigrate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flyway.setInitOnMigrate()
方法的具体详情如下:
包路径:com.googlecode.flyway.core.Flyway
类名称:Flyway
方法名:setInitOnMigrate
[英]Whether to automatically call init when migrate is executed against a non-empty schema with no metadata table. This schema will then be initialized with the initialVersion before executing the migrations. Only migrations above initialVersion will then be applied.
This is useful for initial Flyway production deployments on projects with an existing DB.
Be careful when enabling this as it removes the safety net that ensures Flyway does not migrate the wrong database in case of a configuration mistake!
[中]在对没有元数据表的非空架构执行迁移时,是否自动调用init。然后,在执行迁移之前,将使用initialVersion初始化此架构。然后只应用initialVersion以上的迁移。
这对于使用现有DB的项目上的初始Flyway生产部署非常有用。
启用此功能时要小心,因为它会移除安全网,以确保Flyway在配置错误时不会迁移错误的数据库!
代码示例来源:origin: minnal/minnal
public MigrationsPlugin(Flyway flyway) {
this.flyway = flyway;
this.flyway.setInitOnMigrate(true);
this.flyway.setSchemas("PUBLIC");
}
代码示例来源:origin: SAP/olingo-jpa-processor-v4
flyway.setInitOnMigrate(true);
flyway.setSchemas(DB_SCHEMA);
flyway.migrate();
代码示例来源:origin: com.googlecode.flyway/flyway-core
setInitOnMigrate(Boolean.parseBoolean(initOnMigrateProp));
代码示例来源: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();
}
}
内容来源于网络,如有侵权,请联系作者删除!