本文整理汇总了Java中org.flywaydb.core.Flyway.info方法的典型用法代码示例。如果您正苦于以下问题:Java Flyway.info方法的具体用法?Java Flyway.info怎么用?Java Flyway.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.flywaydb.core.Flyway
的用法示例。
在下文中一共展示了Flyway.info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.flywaydb.core.Flyway; //导入方法依赖的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");
}
}
示例2: getDatabaseVersion
import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
private static MigrationVersion getDatabaseVersion(DataSource dataSource) throws FlywayException {
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
MigrationInfoService info = flyway.info();
MigrationVersion currentVersion = MigrationVersion.EMPTY;
if (info.current() != null) {
currentVersion = info.current().getVersion();
}
return currentVersion;
}
示例3: run
import org.flywaydb.core.Flyway; //导入方法依赖的package包/类
@Override
public void run(final Flyway flyway) {
flyway.info();
}