RoomDatabase.MigrationContainer



A container to hold migrations. It also allows querying its contents to find migrations between two versions.

Summary

Public constructors

Cmn
N

Public functions

Unit

Adds the given migrations to the list of available migrations.

Cmn
N
Boolean
contains(startVersion: Int, endVersion: Int)

Indicates if the given migration is contained within the MigrationContainer based on its start-end versions.

Cmn
N
Map<IntMap<IntMigration>>

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).

Cmn
N

Public constructors

MigrationContainer

MigrationContainer()

MigrationContainer

MigrationContainer()

Public functions

addMigrations

fun addMigrations(migrations: List<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: List<Migration>

List of available migrations.

contains

fun contains(startVersion: Int, endVersion: Int): Boolean

Indicates if the given migration is contained within the MigrationContainer based on its start-end versions.

Parameters
startVersion: Int

Start version of the migration.

endVersion: Int

End version of the migration

Returns
Boolean

True if it contains a migration with the same start-end version, false otherwise.

getMigrations

fun getMigrations(): Map<IntMap<IntMigration>>

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<IntMap<IntMigration>>

Map of migrations keyed by the start version