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


Java MigrationInfo类代码示例

本文整理汇总了Java中org.flywaydb.core.api.MigrationInfo的典型用法代码示例。如果您正苦于以下问题:Java MigrationInfo类的具体用法?Java MigrationInfo怎么用?Java MigrationInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

MigrationInfo类属于org.flywaydb.core.api包,在下文中一共展示了MigrationInfo类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onStartup

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
@PostConstruct
    private void onStartup() {
        if (dataSource == null) {
            log.severe("No datasource found to execute the db migrations!");
            throw new EJBException("No datasource found to execute the db migrations!");
        }

        Flyway flyway = new Flyway();
        flyway.setDataSource(dataSource);
        flyway.setBaselineOnMigrate(true);
        for (MigrationInfo i : flyway.info().all()) {
            log.log(Level.INFO, "Migrate task: {0} : {1} from file: {2}", new Object[]{i.getVersion(), i.getDescription(), i.getScript()});
        }
        flyway.migrate();

        // aby ustawił kierunki relacji z pliku, odkomentować i ustawić ścieżkę do pliku disp_relations.cfg
//        try {
//            TempRelationsDirectionsUpdater.run("/home/rdyszlewski/Projekty/wordnetloom3/WordnetLoom/wordnetloom-client/src/main/resources/disp_relations.cfg", dataSource.getConnection());
//        } catch (SQLException e) {
//            e.printStackTrace();
//        }
    }
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:23,代码来源:DbMigrator.java


示例2: afterEachMigrate

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
@Override
public void afterEachMigrate(Connection connection, MigrationInfo info) {
    super.afterEachMigrate(connection, info);
    String currentVersion = info.getVersion().getVersion();
    if (JooqMigration.didExecute) {
        String migratorGeneratedModelPackage = migratorModelPackage + ".v" + currentVersion;
        Path migratorGeneratedSourcesPackage = computeMigratorGeneratedSourcePackageDir(migratorGeneratedModelPackage);
        if (JooqMigration.ddlInstructionExecuted) {
            System.out.println("Generating migration model for version " + currentVersion + " in " + migratorGeneratedSourcesDir);
            deleteRecursivelyIfExisting(migratorGeneratedSourcesPackage);
            generate(createConfiguration(migratorGeneratedSourcesDir, migratorGeneratedModelPackage, Optional.of(currentVersion)));
        } else {
            System.out.println("No migration model for version " + currentVersion + " in " + migratorGeneratedSourcesDir);
            deleteRecursivelyIfExisting(migratorGeneratedSourcesPackage);
        }
    }
}
 
开发者ID:cluelessjoe,项目名称:jooq-flyway-typesafe-migration,代码行数:18,代码来源:ModelSynchronizer.java


示例3: onStartup

import org.flywaydb.core.api.MigrationInfo; //导入依赖的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: shouldBuildDatabaseFromScratch

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
@Test
public void shouldBuildDatabaseFromScratch() throws SQLException {
  flyway.clean();

  assertThat(flyway.info().applied(), arrayWithSize(0));

  flyway.baseline();
  flyway.migrate();

  MigrationInfo[] appliedMigrations = flyway.info().applied();

  assertThat(appliedMigrations, arrayWithSize(greaterThan(0)));
  assertThat(flyway.info().pending(), arrayWithSize(0));

  for (MigrationInfo migrationInfo : appliedMigrations) {
    assertThat(migrationInfo.getDescription(), migrationInfo.getState(), anyOf(is(MigrationState.SUCCESS), is(MigrationState.MISSING_SUCCESS), is(MigrationState.BASELINE)));
  }
}
 
开发者ID:BandwidthOnDemand,项目名称:bandwidth-on-demand,代码行数:19,代码来源:DatabaseMigrationTestIntegration.java


示例5: invoke

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
@Override
public List<FlywayMigration> invoke() {
	List<FlywayMigration> migrations = new ArrayList<FlywayMigration>();
	for (MigrationInfo info : this.flyway.info().all()) {
		migrations.add(new FlywayMigration(info));
	}
	return migrations;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:FlywayEndpoint.java


示例6: FlywayMigration

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
public FlywayMigration(MigrationInfo info) {
	this.type = info.getType();
	this.checksum = info.getChecksum();
	this.version = nullSafeToString(info.getVersion());
	this.description = info.getDescription();
	this.script = info.getScript();
	this.state = info.getState();
	this.installedOn = info.getInstalledOn();
	this.executionTime = info.getExecutionTime();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:FlywayEndpoint.java


示例7: run

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
@Override protected void run(Bootstrap<KeywhizConfig> bootstrap, Namespace namespace,
    KeywhizConfig config) throws Exception {
  DataSource dataSource = config.getDataSourceFactory()
      .build(new MetricRegistry(), "migration-preview-datasource");

  Flyway flyway = new Flyway();
  flyway.setDataSource(dataSource);
  flyway.setLocations(config.getMigrationsDir());
  MigrationInfoService info = flyway.info();

  MigrationInfo current = info.current();
  if (current == null) {
    logger.info("No migrations have been run yet.");
  } else {
    logger.info("Currently applied migration:");
    logger.info("* {} - {}", current.getVersion(), current.getDescription());
  }

  if (info.pending().length > 0) {
    logger.info("Pending migrations:");
    for (MigrationInfo migration : info.pending()) {
      logger.info("* {} - {}", migration.getVersion(), migration.getDescription());
    }
  } else {
    logger.info("No pending migrations");
  }
}
 
开发者ID:square,项目名称:keywhiz,代码行数:28,代码来源:PreviewMigrateCommand.java


示例8: FlywayMigration

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
public FlywayMigration(MigrationInfo info) {
	this.type = info.getType();
	this.checksum = info.getChecksum();
	this.version = info.getVersion().toString();
	this.description = info.getDescription();
	this.script = info.getScript();
	this.state = info.getState();
	this.installedOn = info.getInstalledOn();
	this.executionTime = info.getExecutionTime();
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:FlywayEndpoint.java


示例9: listInfo

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
/**
 * <p>listInfo.</p>
 *
 * @return a {@link java.util.Map} object.
 */
@GET
public Map<String, MigrationInfo[]> listInfo() {
    Map<String, MigrationInfo[]> infoMap = Maps.newLinkedHashMap();
    for (String dbName : DataSourceManager.getDataSourceNames()) {
        Flyway flyway = locator.getService(Flyway.class, dbName);
        infoMap.put(dbName, flyway.info().all());
    }
    return infoMap;
}
 
开发者ID:icode,项目名称:ameba,代码行数:15,代码来源:MigrationResource.java


示例10: resolved

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
/**
 * Retrieves the full set of infos about the migrations resolved on the classpath.
 *
 * @return The resolved migrations. An empty array if none.
 */
private List<MigrationInfo> resolved(MigrationInfo[] migrationInfos) {
    if (migrationInfos.length == 0)
        throw new NotFoundException();
    List<MigrationInfo> resolvedMigrations = Lists.newArrayList();
    for (MigrationInfo migrationInfo : migrationInfos) {
        if (migrationInfo.getState().isResolved()) {
            resolvedMigrations.add(migrationInfo);
        }
    }

    return resolvedMigrations;
}
 
开发者ID:icode,项目名称:ameba,代码行数:18,代码来源:MigrationResource.java


示例11: failed

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
/**
 * Retrieves the full set of infos about the migrations that failed.
 *
 * @return The failed migrations. An empty array if none.
 */
private List<MigrationInfo> failed(MigrationInfo[] migrationInfos) {
    if (migrationInfos.length == 0)
        throw new NotFoundException();
    List<MigrationInfo> failedMigrations = Lists.newArrayList();
    for (MigrationInfo migrationInfo : migrationInfos) {
        if (migrationInfo.getState().isFailed()) {
            failedMigrations.add(migrationInfo);
        }
    }

    return failedMigrations;
}
 
开发者ID:icode,项目名称:ameba,代码行数:18,代码来源:MigrationResource.java


示例12: future

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
/**
 * Retrieves the full set of infos about future migrations applied to the DB.
 *
 * @return The future migrations. An empty array if none.
 */
private List<MigrationInfo> future(MigrationInfo[] migrationInfos) {
    if (migrationInfos.length == 0)
        throw new NotFoundException();
    List<MigrationInfo> futureMigrations = Lists.newArrayList();
    for (MigrationInfo migrationInfo : migrationInfos) {
        if ((migrationInfo.getState() == MigrationState.FUTURE_SUCCESS)
                || (migrationInfo.getState() == MigrationState.FUTURE_FAILED)) {
            futureMigrations.add(migrationInfo);
        }
    }

    return futureMigrations;
}
 
开发者ID:icode,项目名称:ameba,代码行数:19,代码来源:MigrationResource.java


示例13: afterEachMigrate

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
@Override
public void afterEachMigrate(Connection connection, MigrationInfo arg1) {

}
 
开发者ID:MusalaSoft,项目名称:atmosphere-server,代码行数:5,代码来源:DataSourceCallback.java


示例14: beforeEachMigrate

import org.flywaydb.core.api.MigrationInfo; //导入依赖的package包/类
@Override
public void beforeEachMigrate(Connection connection, MigrationInfo migrationInfo) {

}
 
开发者ID:MusalaSoft,项目名称:atmosphere-server,代码行数:5,代码来源:DataSourceCallback.java



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