MigrationContainer
open class MigrationContainer
kotlin.Any | |
↳ | androidx.room.RoomDatabase.MigrationContainer |
A container to hold migrations. It also allows querying its contents to find migrations between two versions.
Summary
Public constructors |
|
---|---|
<init>() A container to hold migrations. |
Public methods |
|
---|---|
open Unit |
addMigrations(@NonNull vararg migrations: Migration!) Adds the given migrations to the list of available migrations. |
open MutableList<Migration!>? |
findMigrationPath(start: Int, end: Int) Finds the list of migrations that should be run to move from |
Public constructors
<init>
MigrationContainer()
A container to hold migrations. It also allows querying its contents to find migrations between two versions.
Public methods
addMigrations
open fun addMigrations(@NonNull vararg migrations: Migration!): Unit
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
@Nullable open fun findMigrationPath(start: Int, end: Int): MutableList<Migration!>?
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 |
Return | |
---|---|
MutableList<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 . |