RoomDatabase.MigrationContainer
public
static
class
RoomDatabase.MigrationContainer
extends Object
| java.lang.Object | |
| ↳ | androidx.room.RoomDatabase.MigrationContainer |
A container to hold migrations. It also allows querying its contents to find migrations between two versions.
Summary
Public constructors | |
|---|---|
MigrationContainer()
|
|
Public methods | |
|---|---|
void
|
addMigrations(List<Migration> migrations)
Adds the given migrations to the list of available migrations. |
void
|
addMigrations(Migration... migrations)
Adds the given migrations to the list of available migrations. |
List<Migration>
|
findMigrationPath(int start, int end)
Finds the list of migrations that should be run to move from |
Map<Integer, Map<Integer, Migration>>
|
getMigrations()
Returns the map of available migrations where the key is the start version of the migration, and the value is a map of (end version -> Migration). |
Inherited methods | |
|---|---|
Public constructors
MigrationContainer
public MigrationContainer ()
Public methods
addMigrations
public void addMigrations (List<Migration> migrations)
Adds the given migrations to the list of available migrations. If 2 migrations have the same start-end versions, the latter migration overrides the previous one.
| Parameters | |
|---|---|
migrations |
List: List of available migrations.
|
addMigrations
public void addMigrations (Migration... migrations)
Adds the given migrations to the list of available migrations. If 2 migrations have the same start-end versions, the latter migration overrides the previous one.
| Parameters | |
|---|---|
migrations |
Migration: List of available migrations.
|
findMigrationPath
public List<Migration> findMigrationPath (int start, int end)
Finds the list of migrations that should be run to move from start version to
end version.
| Parameters | |
|---|---|
start |
int: The current database version |
end |
int: The target database version |
| Returns | |
|---|---|
List<Migration> |
An ordered list of Migration objects that should be run to migrate
between the given versions. If a migration path cannot be found, returns null.
|
getMigrations
public Map<Integer, Map<Integer, Migration>> getMigrations ()
Returns the map of available migrations where the key is the start version of the migration, and the value is a map of (end version -> Migration).
| Returns | |
|---|---|
Map<Integer, Map<Integer, Migration>> |
Map of migrations keyed by the start version |