当前位置: 首页>>代码示例>>Java>>正文


Java Flyway.repair方法代码示例

本文整理汇总了Java中org.flywaydb.core.Flyway.repair方法的典型用法代码示例。如果您正苦于以下问题:Java Flyway.repair方法的具体用法?Java Flyway.repair怎么用?Java Flyway.repair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.flywaydb.core.Flyway的用法示例。


在下文中一共展示了Flyway.repair方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initFlyway

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
/**
 * Initialise Flyway
 * 
 * @param ds
 */
private void initFlyway(DataSource ds) {
	try {
		logger.info("Database analysis: in progress...");
		Flyway flyway = new Flyway();
		flyway.setDataSource(ds);
		flyway.setCallbacks(new FlywayCallbackMigration());
		flyway.setBaselineOnMigrate(true);
		flyway.setValidateOnMigrate(true);
		flyway.repair();
		flyway.migrate();
		logger.info("Database analysis: finish...");
	} catch (Exception e) {
		logger.error("Database analysis: ERROR", e);
		throw e;
	}
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:22,代码来源:JpaConfigEcandidat.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: onStartup

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
@PostConstruct
private void onStartup() throws SQLException {
	if (dataSource == null) {
		LOG.error("no datasource found to execute the db migrations!");
		throw new EJBException(
				"no datasource found to execute the db migrations!");
	}

	String schema = "sql" + FS + "mysql";
	if (DB != null) {
		 schema = "sql" + FS + DB;
	}
	Flyway flyway = new Flyway();
	flyway.setDataSource(dataSource);
	flyway.setBaselineOnMigrate(true);
	flyway.setPlaceholderPrefix("%{");
	flyway.setLocations("sql" + FS + "configdata", schema);
	flyway.setBaselineVersion(MigrationVersion.fromVersion("201609221422"));
	for (MigrationInfo i : flyway.info().all()) {
		LOG.info("migrate task: " + i.getVersion() + " : "
				+ i.getDescription() + " from file: " + i.getScript());
	}
	flyway.repair();
	flyway.migrate();
}
 
开发者ID:witchpou,项目名称:lj-projectbuilder,代码行数:26,代码来源:DataStartupService.java

示例4: initDatabase

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
private void initDatabase(ReaperApplicationConfiguration config) throws ReaperException {
  Flyway flyway = new Flyway();
  DataSourceFactory dsfactory = config.getDataSourceFactory();
  flyway.setDataSource(
      dsfactory.getUrl(),
      dsfactory.getUser(),
      dsfactory.getPassword());

  if ("database".equals(config.getStorageType())) {
    LOG.warn("!!!!!!!!!!    USAGE 'database' AS STORAGE TYPE IS NOW DEPRECATED   !!!!!!!!!!!!!!");
    LOG.warn("!!!!!!!!!!    PLEASE USE EITHER 'postgres' OR 'h2' FROM NOW ON     !!!!!!!!!!!!!!");
    if (config.getDataSourceFactory().getUrl().contains("h2")) {
      flyway.setLocations("/db/h2");
    } else {
      flyway.setLocations("/db/postgres");
    }
  } else {
    flyway.setLocations("/db/".concat(config.getStorageType().toLowerCase()));
  }
  flyway.setBaselineOnMigrate(true);
  flyway.repair();
  flyway.migrate();
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:24,代码来源:ReaperApplication.java

示例5: migrate

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
public void migrate() {
    try {
        System.out.println("start migration");
        Flyway flyway = new Flyway();
        flyway.setDataSource(url, username, password);
        flyway.repair();// repair migration data schema before migrating
        flyway.migrate();
    } catch (FlywayException e) {
        e.printStackTrace();
    }
}
 
开发者ID:codedrinker,项目名称:commenthub,代码行数:12,代码来源:Migrations.java

示例6: run

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
@Override
public void run() {
	// Perform Database Migration
	Flyway flyway = new Flyway();
	flyway.setBaselineOnMigrate(true);
	flyway.setLocations("io/andrewohara/tinkertime/db/migration");
	flyway.setDataSource(connectionString.getUrl(), null, null);
	try {
		flyway.migrate();
	} catch (FlywayException e){
		flyway.repair();
		throw e;
	}
}
 
开发者ID:oharaandrew314,项目名称:TinkerTime,代码行数:15,代码来源:TinkerTimeLauncher.java

示例7: 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

示例8: 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

示例9: migrate

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
public void migrate() {
    Flyway flyway = new Flyway();
    flyway.setDataSource(url, user, password);
    flyway.setPlaceholders(placeholders);
    String[] locations = flyway.getLocations();
    for (int i = 0; i < locations.length; i++) {
        locations[i] = locations[i]+"/"+getFolder(dialect);
    }
    flyway.setLocations(locations);
    flyway.repair();
    flyway.migrate();
}
 
开发者ID:AveryRegier,项目名称:club-tracker,代码行数:13,代码来源:ConfiguredConnector.java

示例10: run

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
@Override
public void run(final Namespace namespace, final Flyway flyway) throws Exception {
    flyway.repair();
}
 
开发者ID:dropwizard,项目名称:dropwizard-flyway,代码行数:5,代码来源:DbRepairCommand.java

示例11: run

import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
@Override
public void run(final Flyway flyway) {
  flyway.repair();
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:5,代码来源:Flywaydb.java


注:本文中的org.flywaydb.core.Flyway.repair方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。