当前位置: 首页>>代码示例>>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;未经允许,请勿转载。