Java Code Examples for org.flywaydb.core.Flyway#setTable()

The following examples show how to use org.flywaydb.core.Flyway#setTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShellFlywayFactory.java    From registry with Apache License 2.0 6 votes vote down vote up
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.getConfiguration(), location, shellMigrationPrefix, shellMigrationSeperator, shellMigrationSuffix));
    flyway.setDataSource(conf.getUrl(), conf.getUser(), conf.getPassword(), null);

    return flyway;
}
 
Example 2
Source File: SchemaFlywayFactory.java    From registry with Apache License 2.0 6 votes vote down vote up
private static Flyway basicFlyway(StorageProviderConfiguration conf,
                                  String scriptRootPath,
                                  boolean validateOnMigrate) {
    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);

    return flyway;
}
 
Example 3
Source File: DatabaseMigrator.java    From lemon with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example 4
Source File: CMSMigrations.java    From StubbornJava with MIT License 5 votes vote down vote up
public static void migrate() {
    Flyway flyway = new Flyway();
    flyway.setDataSource(CMSConnectionPools.processing());
    flyway.setBaselineOnMigrate(true);
    flyway.setLocations("db/cms/migration");
    flyway.setSqlMigrationPrefix("V_");
    flyway.setTable("_flyway");
    flyway.migrate();
}
 
Example 5
Source File: ApolloMyBatisModule.java    From apollo with Apache License 2.0 5 votes vote down vote up
private void migrateDatabase() {
    String jdbcUrl = String.format(JDBC_URL_FORMAT, configuration.getHost(), configuration.getPort(),
            configuration.getSchema());

    Flyway flyway = new Flyway();
    flyway.setOutOfOrder(true);
    flyway.setDataSource(jdbcUrl, configuration.getUser(), configuration.getPassword());
    flyway.setTable("schema_version");
    flyway.migrate();
}
 
Example 6
Source File: CMSMigrations.java    From StubbornJava with MIT License 5 votes vote down vote up
public static void migrate() {
    Flyway flyway = new Flyway();
    flyway.setDataSource(CMSConnectionPools.processing());
    flyway.setBaselineOnMigrate(true);
    flyway.setLocations("db/cms/migration");
    flyway.setSqlMigrationPrefix("V_");
    flyway.setTable("_flyway");
    flyway.migrate();
}