DatabaseConfiguration

open class DatabaseConfiguration


Configuration class for a RoomDatabase.

Summary

Public functions

open Boolean
isMigrationRequired(fromVersion: Int, toVersion: Int)

Returns whether a migration is required between two versions.

open Boolean

This function is deprecated. Use [isMigrationRequired(int, int)] which takes [allowDestructiveMigrationOnDowngrade] into account.

Public properties

Boolean
Boolean

Whether Room should throw an exception for queries run on the main thread.

List<AutoMigrationSpec>
List<RoomDatabase.Callback>?
Context

The context to use while connecting to the database.

String?
File?
Callable<InputStream>?
RoomDatabase.JournalMode

The journal mode for this database.

RoomDatabase.MigrationContainer

Collection of available migrations.

Boolean

If true, table invalidation in an instance of RoomDatabase is broadcast and synchronized with other instances of the same RoomDatabase file, including those in a separate process.

String?

The name of the database file or null if it is an in-memory database.

RoomDatabase.PrepackagedDatabaseCallback?
Executor

The Executor used to execute asynchronous queries.

Boolean
SupportSQLiteOpenHelper.Factory

The factory to use to access the database.

Executor

The Executor used to execute asynchronous transactions.

List<Any>

Public functions

isMigrationRequired

Added in 2.1.0
open fun isMigrationRequired(fromVersion: Int, toVersion: Int): Boolean

Returns whether a migration is required between two versions.

Parameters
fromVersion: Int

The old schema version.

toVersion: Int

The new schema version.

Returns
Boolean

True if a valid migration is required, false otherwise.

isMigrationRequiredFrom

Added in 2.0.0
Deprecated in 2.1.0
open fun isMigrationRequiredFrom(version: Int): Boolean

Returns whether a migration is required from the specified version.

Parameters
version: Int

The schema version.

Returns
Boolean

True if a valid migration is required, false otherwise.

Public properties

allowDestructiveMigrationOnDowngrade

Added in 2.1.0
val allowDestructiveMigrationOnDowngradeBoolean

allowMainThreadQueries

Added in 2.0.0
val allowMainThreadQueriesBoolean

Whether Room should throw an exception for queries run on the main thread.

autoMigrationSpecs

Added in 2.4.0
val autoMigrationSpecsList<AutoMigrationSpec>

callbacks

Added in 2.0.0
val callbacksList<RoomDatabase.Callback>?

context

Added in 2.0.0
val contextContext

The context to use while connecting to the database.

copyFromAssetPath

Added in 2.2.0
val copyFromAssetPathString?

copyFromFile

Added in 2.2.0
val copyFromFileFile?

copyFromInputStream

Added in 2.3.0
val copyFromInputStreamCallable<InputStream>?

journalMode

Added in 2.0.0
val journalModeRoomDatabase.JournalMode

The journal mode for this database.

migrationContainer

Added in 2.0.0
val migrationContainerRoomDatabase.MigrationContainer

Collection of available migrations.

multiInstanceInvalidation

Added in 2.1.0
val multiInstanceInvalidationBoolean

If true, table invalidation in an instance of RoomDatabase is broadcast and synchronized with other instances of the same RoomDatabase file, including those in a separate process.

name

Added in 2.0.0
val nameString?

The name of the database file or null if it is an in-memory database.

prepackagedDatabaseCallback

Added in 2.3.0
val prepackagedDatabaseCallbackRoomDatabase.PrepackagedDatabaseCallback?

queryExecutor

Added in 2.0.0
val queryExecutorExecutor

The Executor used to execute asynchronous queries.

requireMigration

Added in 2.0.0
val requireMigrationBoolean

sqliteOpenHelperFactory

Added in 2.0.0
val sqliteOpenHelperFactorySupportSQLiteOpenHelper.Factory

The factory to use to access the database.

transactionExecutor

Added in 2.1.0
val transactionExecutorExecutor

The Executor used to execute asynchronous transactions.

typeConverters

Added in 2.3.0
val typeConvertersList<Any>