java.lang.Object
io.ebean.migration.runner.MigrationTable
Manages the migration table.
-
Constructor Summary
ConstructorsConstructorDescriptionMigrationTable(MigrationConfig config, Connection connection, boolean checkState, MigrationPlatform platform) Construct with server, configuration and jdbc connection (DB admin user). -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate the table is it does not exist.Returns the versions that are already applied.booleanisEmpty()Return true if there are no migrations.runAll(List<LocalMigrationResource> localVersions) Run all the migrations in order as needed.runInit(LocalMigrationResource initVersion, List<LocalMigrationResource> localVersions) Run using an init migration.voidRun non transactional statements (if any) after migration commit.intsize()Return the number of migrations in the DB migration table.voidRelease a lock on the migration table (MySql, MariaDB only).
-
Constructor Details
-
MigrationTable
public MigrationTable(MigrationConfig config, Connection connection, boolean checkState, MigrationPlatform platform) Construct with server, configuration and jdbc connection (DB admin user).
-
-
Method Details
-
size
public int size()Return the number of migrations in the DB migration table. -
getVersions
Returns the versions that are already applied. -
createIfNeededAndLock
Create the table is it does not exist.Also holds DB lock on migration table and loads existing migrations.
- Throws:
SQLExceptionIOException
-
unlockMigrationTable
Release a lock on the migration table (MySql, MariaDB only).- Throws:
SQLException
-
isEmpty
public boolean isEmpty()Return true if there are no migrations. -
runAll
@Nonnull 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
@Nonnull 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.
-