本文整理匯總了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();
}