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: CoroutineContext?
)
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: CoroutineContext?
)

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 allowDestructiveMigrationForAllTables: Boolean

allowDestructiveMigrationOnDowngrade

val allowDestructiveMigrationOnDowngrade: Boolean

allowMainThreadQueries

val allowMainThreadQueries: Boolean

autoMigrationSpecs

val autoMigrationSpecs: List<AutoMigrationSpec>

callbacks

val callbacks: List<RoomDatabase.Callback>?

context

val context: Context

copyFromAssetPath

val copyFromAssetPath: String?

copyFromFile

val copyFromFile: File?

copyFromInputStream

val copyFromInputStream: Callable<InputStream>?

journalMode

val journalMode: RoomDatabase.JournalMode

migrationContainer

val migrationContainer: RoomDatabase.MigrationContainer

multiInstanceInvalidation

val multiInstanceInvalidation: 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.

name

val name: String?

prepackagedDatabaseCallback

val prepackagedDatabaseCallback: RoomDatabase.PrepackagedDatabaseCallback?

queryCoroutineContext

val queryCoroutineContext: CoroutineContext?

queryExecutor

val queryExecutor: Executor

requireMigration

val requireMigration: Boolean

sqliteDriver

val sqliteDriver: SQLiteDriver?

sqliteOpenHelperFactory

val sqliteOpenHelperFactory: SupportSQLiteOpenHelper.Factory?

transactionExecutor

val transactionExecutor: Executor

typeConverters

val typeConverters: List<Any>