Package io.ebean.migration.runner
Class MigrationTable
- java.lang.Object
-
- io.ebean.migration.runner.MigrationTable
-
public class MigrationTable extends Object
Manages the migration table.
-
-
Constructor Summary
Constructors Constructor Description MigrationTable(MigrationConfig config, Connection connection, boolean checkState, MigrationPlatform platform)Construct with server, configuration and jdbc connection (DB admin user).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateIfNeededAndLock()Create the table is it does not exist.Set<String>getVersions()Returns the versions that are already applied.booleanisEmpty()Return true if there are no migrations.List<LocalMigrationResource>runAll(List<LocalMigrationResource> localVersions)Run all the migrations in order as needed.List<LocalMigrationResource>runInit(LocalMigrationResource initVersion, List<LocalMigrationResource> localVersions)Run using an init migration.voidrunNonTransactional()Run non transactional statements (if any) after migration commit.intsize()Return the number of migrations in the DB migration table.
-
-
-
Constructor Detail
-
MigrationTable
public MigrationTable(MigrationConfig config, Connection connection, boolean checkState, MigrationPlatform platform)
Construct with server, configuration and jdbc connection (DB admin user).
-
-
Method Detail
-
size
public int size()
Return the number of migrations in the DB migration table.
-
getVersions
public Set<String> getVersions()
Returns the versions that are already applied.
-
createIfNeededAndLock
public void createIfNeededAndLock() throws SQLException, IOException
Create the table is it does not exist.Also holds DB lock on migration table and loads existing migrations.
- Throws:
SQLExceptionIOException
-
isEmpty
public boolean isEmpty()
Return true if there are no migrations.
-
runAll
public List<LocalMigrationResource> runAll(List<LocalMigrationResource> localVersions) throws SQLException
Run all the migrations in order as needed.- Returns:
- the migrations that have been run (collected if checkstate is true).
- Throws:
SQLException
-
runInit
public List<LocalMigrationResource> runInit(LocalMigrationResource initVersion, List<LocalMigrationResource> localVersions) throws SQLException
Run using an init migration.- Returns:
- the migrations that have been run (collected if checkstate is true).
- Throws:
SQLException
-
runNonTransactional
public void runNonTransactional()
Run non transactional statements (if any) after migration commit.These run with auto commit true and run AFTER the migration commit and as such the migration isn't truely atomic - the migration can run and complete and the non-transactional statements fail.
-
-