當前位置: 首頁>>代碼示例>>Java>>正文


Java Flyway.setTable方法代碼示例

本文整理匯總了Java中org.flywaydb.core.Flyway.setTable方法的典型用法代碼示例。如果您正苦於以下問題:Java Flyway.setTable方法的具體用法?Java Flyway.setTable怎麽用?Java Flyway.setTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.flywaydb.core.Flyway的用法示例。


在下文中一共展示了Flyway.setTable方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateDatabase

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@PostConstruct
public void updateDatabase() throws IOException {
    try {
        Flyway flyway = new Flyway();
        flyway.setEncoding("UTF-8");
        flyway.setTable("flyway_schema");
        flyway.setLocations("db/migration");
        flyway.setSchemas(env.getProperty(PropertyNames.jdbcUser));
        flyway.setDataSource(
                env.getProperty(PropertyNames.jdbcURL),
                env.getProperty(PropertyNames.flywayUser),
                env.getProperty(PropertyNames.flywayPassword));

        flyway.setBaselineOnMigrate(true);
        flyway.migrate();
    } catch (Exception e) {
        log.error("FAILED TO MIGRATE DATABASE", e);
    }
}
 
開發者ID:solita,項目名稱:kansalaisaloite,代碼行數:20,代碼來源:JdbcConfiguration.java

示例2: doMigrate

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
public void doMigrate(String table, String location) {
    logger.info("migrate : {}, {}", table, location);

    Flyway flyway = new Flyway();
    flyway.setPlaceholderPrefix("$${");
    // flyway.setInitOnMigrate(true);
    flyway.setBaselineOnMigrate(true);
    // flyway.setInitVersion("0");
    flyway.setBaselineVersionAsString("0");
    flyway.setDataSource(dataSource);
    flyway.setTable(table);
    flyway.setLocations(new String[] { location });

    try {
        flyway.repair();
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
    }

    flyway.migrate();
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:22,代碼來源:DatabaseMigrator.java

示例3: get

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
public static Flyway get(StorageProviderConfiguration conf, String scriptRootPath) {
    Flyway flyway = new Flyway();

    String location = "filesystem:" + scriptRootPath;
    flyway.setEncoding(encoding);
    flyway.setTable(metaDataTableName);
    flyway.setValidateOnMigrate(validateOnMigrate);
    flyway.setOutOfOrder(outOfOrder);
    flyway.setBaselineOnMigrate(baselineOnMigrate);
    flyway.setBaselineVersion(MigrationVersion.fromVersion(baselineVersion));
    flyway.setCleanOnValidationError(cleanOnValidationError);
    flyway.setLocations(location);
    flyway.setResolvers(new ShellMigrationResolver(flyway.getClassLoader(), location, shellMigrationPrefix, shellMigrationSeperator, shellMigrationSuffix));
    flyway.setDataSource(conf.getUrl(), conf.getUser(), conf.getPassword(), null);

    return flyway;
}
 
開發者ID:hortonworks,項目名稱:registry,代碼行數:18,代碼來源:ShellFlywayFactory.java

示例4: get

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
public static Flyway get(StorageProviderConfiguration conf, String scriptRootPath) {
    Flyway flyway = new Flyway();

    String location = "filesystem:" + scriptRootPath + File.separator + conf.getDbType();
    flyway.setEncoding(encoding);
    flyway.setTable(metaDataTableName);
    flyway.setSqlMigrationPrefix(sqlMigrationPrefix);
    flyway.setValidateOnMigrate(validateOnMigrate);
    flyway.setOutOfOrder(outOfOrder);
    flyway.setBaselineOnMigrate(baselineOnMigrate);
    flyway.setBaselineVersion(MigrationVersion.fromVersion(baselineVersion));
    flyway.setCleanOnValidationError(cleanOnValidationError);
    flyway.setLocations(location);
    flyway.setDataSource(conf.getUrl(), conf.getUser(), conf.getPassword(), null);

    return flyway;
}
 
開發者ID:hortonworks,項目名稱:registry,代碼行數:18,代碼來源:SchemaFlywayFactory.java

示例5: updateDatabase

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@PostConstruct
public void updateDatabase() throws IOException {
    Flyway flyway = new Flyway();
    flyway.setEncoding("UTF-8");
    flyway.setTable("flyway_schema");
    flyway.setLocations("testmigration");
    flyway.setSchemas(env.getProperty(PropertyNames.jdbcUser));
    flyway.setDataSource(
            env.getProperty(PropertyNames.jdbcURL),
            env.getProperty(PropertyNames.flywayUser),
            env.getProperty(PropertyNames.flywayPassword));

    flyway.setBaselineOnMigrate(true);
    flyway.migrate();

}
 
開發者ID:solita,項目名稱:kansalaisaloite,代碼行數:17,代碼來源:IntegrationTestConfiguration.java

示例6: start

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Override
public boolean start() {
    _gcExecutor.scheduleWithFixedDelay(new ContainerClusterGarbageCollector(), 300, 300, TimeUnit.SECONDS);
    _stateScanner.scheduleWithFixedDelay(new ContainerClusterStatusScanner(), 300, 30, TimeUnit.SECONDS);

    // run the data base migration.
    Properties dbProps = DbProperties.getDbProperties();
    final String cloudUsername = dbProps.getProperty("db.cloud.username");
    final String cloudPassword = dbProps.getProperty("db.cloud.password");
    final String cloudHost = dbProps.getProperty("db.cloud.host");
    final int cloudPort = Integer.parseInt(dbProps.getProperty("db.cloud.port"));
    final String dbUrl = "jdbc:mysql://" + cloudHost + ":" + cloudPort + "/cloud";

    try {
        Flyway flyway = new Flyway();
        flyway.setDataSource(dbUrl, cloudUsername, cloudPassword);

        // name the meta table as sb_ccs_schema_version
        flyway.setTable("sb_ccs_schema_version");

        // make the existing cloud DB schema and data as baseline
        flyway.setBaselineOnMigrate(true);
        flyway.setBaselineVersionAsString("0");

        // apply CCS schema
        flyway.migrate();
    } catch (FlywayException fwe) {
        s_logger.error("Failed to run migration on Cloudstack Container Service database due to " + fwe);
        return false;
    }

    return true;
}
 
開發者ID:shapeblue,項目名稱:ccs,代碼行數:34,代碼來源:ContainerClusterManagerImpl.java

示例7: build

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
public Flyway build(final DataSource dataSource) {
    final String[] fwSchemas = new String[schemas.size()];
    final String[] fwCallbacks = new String[callbacks.size()];
    final String[] fwLocations = new String[locations.size()];
    final String[] fwResolvers = new String[resolvers.size()];

    final Flyway flyway = new Flyway();

    if (null != classLoader) {
        flyway.setClassLoader(classLoader);
    }

    flyway.setDataSource(dataSource);
    flyway.setEncoding(encoding);
    flyway.setTable(metaDataTableName);
    flyway.setSqlMigrationPrefix(sqlMigrationPrefix);
    flyway.setSqlMigrationSeparator(sqlMigrationSeparator);
    flyway.setSqlMigrationSuffix(sqlMigrationSuffix);
    flyway.setSchemas(schemas.toArray(fwSchemas));
    flyway.setCallbacksAsClassNames(callbacks.toArray(fwCallbacks));
    flyway.setPlaceholderPrefix(placeholderPrefix);
    flyway.setPlaceholderSuffix(placeholderSuffix);
    flyway.setPlaceholders(placeholders);
    flyway.setLocations(locations.toArray(fwLocations));
    flyway.setResolversAsClassNames(resolvers.toArray(fwResolvers));
    flyway.setOutOfOrder(outOfOrder);
    flyway.setBaselineDescription(baselineDescription);
    flyway.setBaselineOnMigrate(baselineOnMigrate);
    flyway.setValidateOnMigrate(validateOnMigrate);

    return flyway;
}
 
開發者ID:dropwizard,項目名稱:dropwizard-flyway,代碼行數:33,代碼來源:FlywayFactory.java

示例8: FlywayExecutor

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Inject
public FlywayExecutor(@Named("report.metadata.store.jdbc") JDBCPoolDataSource config) {
    Flyway flyway = new Flyway();
    flyway.setBaselineOnMigrate(true);
    flyway.setDataSource(config);
    flyway.setLocations("db/migration/report");
    flyway.setTable("schema_version_report");
    try {
        flyway.migrate();
    } catch (FlywayException e) {
        flyway.repair();
    }
}
 
開發者ID:rakam-io,項目名稱:rakam,代碼行數:14,代碼來源:ServiceStarter.java

示例9: FlywayExecutor

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Inject
public FlywayExecutor(@Named("ui.metadata.jdbc") JDBCConfig config) {
    Flyway flyway = new Flyway();
    flyway.setBaselineOnMigrate(true);
    flyway.setLocations("db/migration/ui");
    flyway.setTable("schema_version_ui");
    flyway.setDataSource(config.getUrl(), config.getUsername(), config.getPassword());
    try {
        flyway.migrate();
    } catch (FlywayException e) {
        flyway.repair();
    }
}
 
開發者ID:rakam-io,項目名稱:rakam,代碼行數:14,代碼來源:RakamUIModule.java


注:本文中的org.flywaydb.core.Flyway.setTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。