diff --git a/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java b/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java index 165febf..b3270f7 100644 --- a/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java +++ b/ebean-migration/src/main/java/io/ebean/migration/MigrationRunner.java @@ -44,6 +44,13 @@ public List checkState(Connection connection) { return run(connection, true); } + /** + * Return the migrations that would be applied if the migration is run. + */ + public List checkState(MigrationContext context) { + return run(context, true); + } + /** * Run by creating a DB connection from driver, url, username defined in MigrationConfig. */ @@ -65,6 +72,13 @@ public void run(Connection connection) { run(connection, false); } + /** + * Run the migrations if there are any that need running. + */ + public void run(MigrationContext context) { + run(context, false); + } + private Connection connection(DataSource dataSource) { String username = migrationConfig.getDbUsername(); try { @@ -86,4 +100,10 @@ private List run(Connection connection, boolean checkStateOnl return new MigrationEngine(migrationConfig, checkStateOnly).run(connection); } + /** + * Run the migrations if there are any that need running. + */ + private List run(MigrationContext context, boolean checkStateOnly) { + return new MigrationEngine(migrationConfig, checkStateOnly).run(context); + } }