Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 2.0.0
belongs to Maven artifact androidx.room:room-runtime:2.0.0-rc01

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

RoomDatabase.MigrationContainer()

Public methods

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 start version to end version.

Inherited methods

Public constructors

RoomDatabase.MigrationContainer

added in version 2.0.0
public RoomDatabase.MigrationContainer ()

Public methods

addMigrations

added in version 2.0.0
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

added in version 2.0.0
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.