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


Java Flyway.clean方法代碼示例

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


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

示例1: cleanMigrateStrategy

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Bean
public FlywayMigrationStrategy cleanMigrateStrategy() {

    FlywayMigrationStrategy strategy = new FlywayMigrationStrategy() {

        @Override
        public void migrate(Flyway flyway) {

            if (clean) {
                logger.info("Clean DB with Flyway");
                flyway.clean();
            } else {
                logger.info("Don't clean DB with Flyway");
            }

            flyway.migrate();
        }
    };

    return strategy;
}
 
開發者ID:box,項目名稱:mojito,代碼行數:22,代碼來源:FlyWayConfig.java

示例2: migrate

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
/**
 * Migrate the database to the latest available migration.
 */
public void migrate() {

  if (this.enabled) {
    final Flyway flyway = new Flyway();
    flyway.setDataSource(this.dataSource);
    if (this.testdata) {
      flyway.setLocations(masterDataPath, testDataPath);
    } else {
      flyway.setLocations(masterDataPath);
    }
    if (this.clean) {
      flyway.clean();
    }
    flyway.migrate();
  }
}
 
開發者ID:oasp,項目名稱:oasp-tutorial-sources,代碼行數:20,代碼來源:DatabaseMigrator.java

示例3: initDatasource

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
public void initDatasource(YadaConfiguration config) throws NamingException {
	MysqlDataSource dataSource = new MysqlDataSource();
	dataSource.setDatabaseName(config.getString("config/database/dbName"));
	dataSource.setUser(config.getString("config/database/user"));
	dataSource.setPassword(config.getString("config/database/password"));
	dataSource.setServerName(config.getString("config/database/server"));
	SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
	builder.bind("java:comp/env/jdbc/yadatestdb", dataSource);
	super.dataSource = dataSource;
	builder.activate();
	// Database
	Flyway flyway = new Flyway();
	flyway.setLocations("filesystem:schema"); // Where sql test scripts are stored
	flyway.setDataSource(dataSource);
	flyway.clean();
	flyway.migrate();
}
 
開發者ID:xtianus,項目名稱:yadaframework,代碼行數:18,代碼來源:YadaTestConfig.java

示例4: apply

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Override public Statement apply(final Statement base, Description description) {
  return new Statement() {
    @Override public void evaluate() throws Throwable {
      File yamlFile = new File(Resources.getResource("keywhiz-test.yaml").getFile());
      Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
      ObjectMapper objectMapper = KeywhizService.customizeObjectMapper(Jackson.newObjectMapper());
      KeywhizConfig config = new ConfigurationFactory<>(KeywhizConfig.class, validator, objectMapper, "dw")
          .build(yamlFile);

      DataSource dataSource = config.getDataSourceFactory()
          .build(new MetricRegistry(), "db-migrations");

      Flyway flyway = new Flyway();
      flyway.setDataSource(dataSource);
      flyway.setLocations(config.getMigrationsDir());
      flyway.clean();
      flyway.migrate();

      DSLContext dslContext = DSLContexts.databaseAgnostic(dataSource);
      DbSeedCommand.doImport(dslContext);

      base.evaluate();
    }
  };
}
 
開發者ID:square,項目名稱:keywhiz,代碼行數:26,代碼來源:MigrationsRule.java

示例5: migrate

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Override
public void migrate(Flyway flyway) {

    if (!databaseExists()) {
        createDatabase();
    }
    flyway.clean();
    flyway.migrate();
}
 
開發者ID:infobip,項目名稱:infobip-spring-data-jpa-querydsl,代碼行數:10,代碼來源:SqlServerFlywayTestMigrationStrategy.java

示例6: cleanMigrationStrategy

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
/**
 * Configures the Flyway migration strategy to clean the DB before migration first.  This is used
 * as the default unless the Spring Profile "production" is active.
 *
 * @return the clean-migrate strategy
 */
@Bean
@Profile("!production")
public FlywayMigrationStrategy cleanMigrationStrategy() {
  FlywayMigrationStrategy strategy = new FlywayMigrationStrategy() {
    @Override
    public void migrate(Flyway flyway) {
      logger.info("Using clean-migrate flyway strategy -- production profile not active");
      flyway.clean();
      flyway.migrate();
    }
  };

  return strategy;
}
 
開發者ID:OpenLMIS,項目名稱:openlmis-stockmanagement,代碼行數:21,代碼來源:Application.java

示例7: cleanMigrationStrategy

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
/**
 * Configures the Flyway migration strategy to clean the DB before migration first.  This is used
 * as the default unless the Spring Profile "production" is active.
 * @return the clean-migrate strategy
 */
@Bean
@Profile("!production")
public FlywayMigrationStrategy cleanMigrationStrategy() {
  FlywayMigrationStrategy strategy = new FlywayMigrationStrategy() {
    @Override
    public void migrate(Flyway flyway) {
      logger.info("Using clean-migrate flyway strategy -- production profile not active");
      flyway.clean();
      flyway.migrate();
    }
  };

  return strategy;
}
 
開發者ID:OpenLMIS,項目名稱:openlmis-template-service,代碼行數:20,代碼來源:Application.java

示例8: prepareDataBase

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Bootstrapping
public static void prepareDataBase(final DataSource ds) {
    // creates db schema and puts some data
    final Flyway flyway = new Flyway();
    flyway.setDataSource(ds);
    flyway.clean();
    flyway.migrate();
}
 
開發者ID:dadrus,項目名稱:jpa-unit,代碼行數:9,代碼來源:AbstractFlywayDbTest.java

示例9: migrate

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
public void migrate() {
	// Create the Flyway instance
	Flyway flyway = new Flyway();

	// Point it to the database
	flyway.setDataSource(JDBCconnection.getConnectionString(),
			JDBCconnection.getUser(), JDBCconnection.getPassword());
	flyway.clean(); // limpando os schemas para sempre executar o flyway.
	flyway.setValidateOnMigrate(false);
	flyway.setBaselineOnMigrate(true);
	// Start the migration
	flyway.migrate();

}
 
開發者ID:willmenn,項目名稱:DerbyPOC,代碼行數:15,代碼來源:Flyway3rdParty.java

示例10: migrateDb

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
protected void migrateDb() {
    Flyway flyway = new Flyway();
    flyway.setDataSource(Postgres.datasource());
    flyway.clean();
    flyway.migrate();
    // TODO Add some test data??
}
 
開發者ID:javaBin,項目名稱:heroes,代碼行數:8,代碼來源:TestWebServer.java

示例11: cleanMigrateStrategy

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Bean
public FlywayMigrationStrategy cleanMigrateStrategy() {
    FlywayMigrationStrategy strategy = new FlywayMigrationStrategy() {
        @Override
        public void migrate(Flyway flyway) {
            flyway.clean();
            flyway.migrate();
        }
    };

    return strategy;
}
 
開發者ID:tudoNoob,項目名稱:poseidon,代碼行數:13,代碼來源:PoseidonApplication.java

示例12: migrateH2Database

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
private static void migrateH2Database(DataSource h2DataSource, Map<String, String> propertyPlaceHolders) {
    logger.info("Migrating exomiser H2 database...");
    Flyway h2Flyway = new Flyway();
    h2Flyway.setDataSource(h2DataSource);
    h2Flyway.setSchemas("EXOMISER");
    h2Flyway.setLocations("migration/common", "migration/h2");
    h2Flyway.setPlaceholders(propertyPlaceHolders);
    h2Flyway.clean();
    h2Flyway.migrate();
}
 
開發者ID:exomiser,項目名稱:Exomiser,代碼行數:11,代碼來源:Main.java

示例13: checkNCreate

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
public void checkNCreate() {
    Flyway flyway = new Flyway();
    // flyway.setDataSource(globalProps.getProperty("jdbcUrl"), globalProps.getProperty("jdbcUser"), globalProps.getProperty("jdbcPwd"));
    OpenConnectionCountDriverDataSource dataSource = OpenConnectionCountDriverDataSource.getInstance(Thread.currentThread().getContextClassLoader(), null, globalProps.getProperty("jdbcUrl"), globalProps.getProperty("jdbcUser"), globalProps.getProperty("jdbcPwd"));
    flyway.setDataSource(dataSource);
    flyway.setLocations("db/migration");
    //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();
}
 
開發者ID:zhoushineyoung,項目名稱:zookeeper-edit,代碼行數:14,代碼來源:Dao.java

示例14: noConnectionLeak

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@Test
public void noConnectionLeak() {
    OpenConnectionCountDriverDataSource dataSource = OpenConnectionCountDriverDataSource.getInstance(null);

    assertEquals(0, dataSource.getOpenConnectionCount());
    Flyway flyway = new Flyway();
    flyway.setDataSource(dataSource);
    flyway.setLocations("migration/sql");
    flyway.clean();
    assertEquals(0, dataSource.getOpenConnectionCount());
    assertEquals(4, flyway.migrate());
    assertEquals(0, dataSource.getOpenConnectionCount());
}
 
開發者ID:zhoushineyoung,項目名稱:zookeeper-edit,代碼行數:14,代碼來源:H2DaoTest.java

示例15: init

import org.flywaydb.core.Flyway; //導入方法依賴的package包/類
@PostConstruct
public void init() {
    if (!enabled) {
        logger.info("skip dbmigrate");

        return;
    }

    long startTime = System.currentTimeMillis();

    if (clean) {
        logger.info("clean database");

        Flyway flyway = new Flyway();
        flyway.setDataSource(dataSource);
        flyway.clean();
    }

    Map<String, ModuleSpecification> map = applicationContext
            .getBeansOfType(ModuleSpecification.class);

    for (ModuleSpecification moduleSpecification : map.values()) {
        if (!moduleSpecification.isEnabled()) {
            logger.info("skip migrate : {}, {}",
                    moduleSpecification.getSchemaTable(),
                    moduleSpecification.getSchemaLocation());

            continue;
        }

        this.doMigrate(moduleSpecification.getSchemaTable(),
                moduleSpecification.getSchemaLocation());

        if (moduleSpecification.isInitData()) {
            this.doMigrate(moduleSpecification.getDataTable(),
                    moduleSpecification.getDataLocation());
        }
    }

    long endTime = System.currentTimeMillis();

    logger.info("dbmigrate cost : {} ms", (endTime - startTime));
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:44,代碼來源:DatabaseMigrator.java


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