當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。