DatabaseConfiguration



Configuration class for a RoomDatabase.

Summary

Public constructors

DatabaseConfiguration(
    name: String?,
    migrationContainer: RoomDatabase.MigrationContainer,
    callbacks: List<RoomDatabase.Callback>?,
    journalMode: RoomDatabase.JournalMode,
    requireMigration: Boolean,
    allowDestructiveMigrationOnDowngrade: Boolean,
    migrationNotRequiredFrom: Set<Int>?,
    typeConverters: List<Any>,
    autoMigrationSpecs: List<AutoMigrationSpec>,
    allowDestructiveMigrationForAllTables: Boolean,
    sqliteDriver: SQLiteDriver?,
    queryCoroutineContext: <Error class: unknown class>?
)
N

Public functions

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

Returns whether a migration is required between two versions.

android
open Boolean

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

android

Public constructors

DatabaseConfiguration

DatabaseConfiguration(
    name: String?,
    migrationContainer: RoomDatabase.MigrationContainer,
    callbacks: List<RoomDatabase.Callback>?,
    journalMode: RoomDatabase.JournalMode,
    requireMigration: Boolean,
    allowDestructiveMigrationOnDowngrade: Boolean,
    migrationNotRequiredFrom: Set<Int>?,
    typeConverters: List<Any>,
    autoMigrationSpecs: List<AutoMigrationSpec>,
    allowDestructiveMigrationForAllTables: Boolean,
    sqliteDriver: SQLiteDriver?,
    queryCoroutineContext: <Error class: unknown class>?
)

Public functions

isMigrationRequired

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

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

allowDestructiveMigrationForAllTables

val allowDestructiveMigrationForAllTablesBoolean

allowDestructiveMigrationOnDowngrade

val allowDestructiveMigrationOnDowngradeBoolean

allowMainThreadQueries

val allowMainThreadQueriesBoolean

autoMigrationSpecs

val autoMigrationSpecsList<AutoMigrationSpec>

callbacks

val callbacksList<RoomDatabase.Callback>?

context

val contextContext

copyFromAssetPath

val copyFromAssetPathString?

copyFromFile

val copyFromFileFile?

copyFromInputStream

val copyFromInputStreamCallable<InputStream>?

journalMode

val journalModeRoomDatabase.JournalMode

migrationContainer

val migrationContainerRoomDatabase.MigrationContainer

multiInstanceInvalidation

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

val nameString?

prepackagedDatabaseCallback

val prepackagedDatabaseCallbackRoomDatabase.PrepackagedDatabaseCallback?

queryCoroutineContext

val queryCoroutineContextCoroutineContext?

queryExecutor

val queryExecutorExecutor

requireMigration

val requireMigrationBoolean

sqliteDriver

val sqliteDriverSQLiteDriver?

sqliteOpenHelperFactory

val sqliteOpenHelperFactorySupportSQLiteOpenHelper.Factory?

transactionExecutor

val transactionExecutorExecutor

typeConverters

val typeConvertersList<Any>