DatabaseConfiguration
open class DatabaseConfiguration
kotlin.Any | |
↳ | androidx.room.DatabaseConfiguration |
Configuration class for a RoomDatabase
.
Summary
Public methods | |
---|---|
open Boolean |
isMigrationRequired(fromVersion: Int, toVersion: Int) Returns whether a migration is required between two versions. |
open Boolean |
isMigrationRequiredFrom(version: Int) Returns whether a migration is required from the specified version. |
Properties | |
---|---|
Boolean |
If true, Room should perform a destructive migration when downgrading without an available migration. |
Boolean |
Whether Room should throw an exception for queries run on the main thread. |
MutableList<RoomDatabase.Callback!>? | |
Context |
The context to use while connecting to the database. |
String? |
The assets path to a pre-packaged database to copy from. |
File? |
The pre-packaged database file to copy from. |
Callable<InputStream!>? |
The callable to get the input stream from which a pre-package database file will be copied from. |
RoomDatabase.JournalMode! |
The journal mode for this database. |
RoomDatabase.MigrationContainer |
Collection of available migrations. |
Boolean |
If true, table invalidation in an instance of |
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 |
If true, Room should crash if a migration is missing. |
SupportSQLiteOpenHelper.Factory |
The factory to use to access the database. |
Executor |
The Executor used to execute asynchronous transactions. |
MutableList<Any!> |
Public methods
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. |
Return | |
---|---|
Boolean |
True if a valid migration is required, false otherwise. |
isMigrationRequiredFrom
open funisMigrationRequiredFrom(version: Int): Boolean
Deprecated: Use isMigrationRequired(int, int)
which takes allowDestructiveMigrationOnDowngrade
into account.
Returns whether a migration is required from the specified version.
Parameters | |
---|---|
version |
Int: The schema version. |
Return | |
---|---|
Boolean |
True if a valid migration is required, false otherwise. |
Properties
allowDestructiveMigrationOnDowngrade
val allowDestructiveMigrationOnDowngrade: Boolean
If true, Room should perform a destructive migration when downgrading without an available migration.
allowMainThreadQueries
val allowMainThreadQueries: Boolean
Whether Room should throw an exception for queries run on the main thread.
callbacks
@Nullable val callbacks: MutableList<RoomDatabase.Callback!>?
copyFromAssetPath
@Nullable val copyFromAssetPath: String?
The assets path to a pre-packaged database to copy from.
copyFromInputStream
@Nullable val copyFromInputStream: Callable<InputStream!>?
The callable to get the input stream from which a pre-package database file will be copied from.
migrationContainer
@NonNull val migrationContainer: RoomDatabase.MigrationContainer
Collection of available migrations.
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
@Nullable val name: String?
The name of the database file or null if it is an in-memory database.
prepackagedDatabaseCallback
@Nullable val prepackagedDatabaseCallback: RoomDatabase.PrepackagedDatabaseCallback?
queryExecutor
@NonNull val queryExecutor: Executor
The Executor used to execute asynchronous queries.
requireMigration
val requireMigration: Boolean
If true, Room should crash if a migration is missing.
sqliteOpenHelperFactory
@NonNull val sqliteOpenHelperFactory: SupportSQLiteOpenHelper.Factory
The factory to use to access the database.
transactionExecutor
@NonNull val transactionExecutor: Executor
The Executor used to execute asynchronous transactions.
typeConverters
@NonNull val typeConverters: MutableList<Any!>