本文整理汇总了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;
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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;
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例10: run
import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
@Override
public void run(final Namespace namespace, final Flyway flyway) throws Exception {
flyway.repair();
}
示例11: run
import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
@Override
public void run(final Flyway flyway) {
flyway.repair();
}