本文整理了Java中com.googlecode.flyway.core.Flyway.migrate()
方法的一些代码示例,展示了Flyway.migrate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flyway.migrate()
方法的具体详情如下:
包路径:com.googlecode.flyway.core.Flyway
类名称:Flyway
方法名:migrate
[英]Starts the database migration. All pending migrations will be applied in order. Calling migrate on an up-to-date database has no effect.
[中]开始数据库迁移。所有挂起的迁移都将按顺序应用。在最新数据库上调用migrate无效。
代码示例来源:origin: DeemOpen/zkui
public void checkNCreate() {
try {
Flyway flyway = new Flyway();
flyway.setDataSource(globalProps.getProperty("jdbcUrl"), globalProps.getProperty("jdbcUser"), globalProps.getProperty("jdbcPwd"));
//Will wipe db each time. Avoid this in prod.
if (globalProps.getProperty("env").equals("dev")) {
flyway.clean();
}
//Remove the above line if deploying to prod.
flyway.migrate();
} catch (Exception ex) {
logger.error("Error trying to migrate db! Not severe hence proceeding forward.");
}
}
代码示例来源:origin: com.intuit.wasabi/wasabi-repository-datastax
void initialize(Flyway flyway) {
flyway.setLocations("com/intuit/wasabi/repository/impl/mysql/migration");
flyway.setDataSource(transactionFactory.getDataSource());
flyway.migrate();
}
代码示例来源:origin: com.intuit.wasabi/wasabi-repository-datastax
private void initialize(Flyway flyway) {
flyway.setLocations("com/intuit/wasabi/repository/impl/mysql/migration");
flyway.setDataSource(transactionFactory.getDataSource());
flyway.migrate();
}
代码示例来源:origin: com.intuit.wasabi/wasabi-repository-datastax
/**
* Initializes the database.
*
* @param flyway flyway instance
*/
void initialize(Flyway flyway, String mutagenRootResourcePath) {
flyway.setLocations(mutagenRootResourcePath);
flyway.setDataSource(transactionFactory.getDataSource());
flyway.migrate();
}
代码示例来源:origin: ch.inftec.ju/ju-testing
@Override
public void execute(DataSource ds) {
Flyway flyway = new Flyway();
flyway.setDataSource(ds);
flyway.setLocations(locations);
flyway.migrate();
}
});
代码示例来源:origin: SAP/olingo-jpa-processor-v4
flyway.setInitOnMigrate(true);
flyway.setSchemas(DB_SCHEMA);
flyway.migrate();
return ds;
代码示例来源:origin: com.googlecode.flyway-test-extensions/flyway-spring4-test
flyWay.migrate();
} finally {
代码示例来源:origin: com.googlecode.flyway-test-extensions/flyway-spring3-test
flyWay.migrate();
} finally {
代码示例来源:origin: com.googlecode.flyway-test-extensions/flyway-spring-test
flyWay.migrate();
} finally {
代码示例来源:origin: minnal/minnal
public void init(Application<? extends ApplicationConfiguration> application) {
DatabaseConfiguration dbConfig = application.getConfiguration().getDatabaseConfiguration();
URI uri = getUri(dbConfig.getUrl());
if (Strings.isNullOrEmpty(uri.getPath())) {
flyway.setDataSource(dbConfig.getUrl(), dbConfig.getUsername(), dbConfig.getPassword());
} else {
flyway.setDataSource(getUrl(uri, false), dbConfig.getUsername(), dbConfig.getPassword());
flyway.setSchemas(uri.getPath().substring(1));
}
flyway.migrate();
}
代码示例来源:origin: com.googlecode.flyway-test-extensions/flyway-spring3-test
flyWay.migrate();
} else {
if ( locations != null && locations.length > 0 //
代码示例来源:origin: com.googlecode.flyway-test-extensions/flyway-spring-test
flyWay.migrate();
} else {
if ( locations != null && locations.length > 0 //
代码示例来源:origin: com.googlecode.flyway-test-extensions/flyway-spring4-test
flyWay.migrate();
} else {
if ( locations != null && locations.length > 0 //
代码示例来源:origin: com.googlecode.flyway/flyway-commandline
flyway.init();
} else if ("migrate".equals(operation)) {
flyway.migrate();
} else if ("validate".equals(operation)) {
flyway.validate();
代码示例来源: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();
}
}
内容来源于网络,如有侵权,请联系作者删除!