DatabaseConfiguration
public
class
DatabaseConfiguration
extends Object
java.lang.Object | |
↳ | androidx.room.DatabaseConfiguration |
Configuration class for a RoomDatabase
.
Summary
Fields | |
---|---|
public
final
boolean |
allowDestructiveMigrationOnDowngrade
If true, Room should perform a destructive migration when downgrading without an available migration. |
public
final
boolean |
allowMainThreadQueries
Whether Room should throw an exception for queries run on the main thread. |
public
final
List<RoomDatabase.Callback> |
callbacks
|
public
final
Context |
context
The context to use while connecting to the database. |
public
final
String |
copyFromAssetPath
The assets path to a pre-packaged database to copy from. |
public
final
File |
copyFromFile
The pre-packaged database file to copy from. |
public
final
RoomDatabase.JournalMode |
journalMode
The journal mode for this database. |
public
final
RoomDatabase.MigrationContainer |
migrationContainer
Collection of available migrations. |
public
final
boolean |
multiInstanceInvalidation
If true, table invalidation in an instance of |
public
final
String |
name
The name of the database file or null if it is an in-memory database. |
public
final
Executor |
queryExecutor
The Executor used to execute asynchronous queries. |
public
final
boolean |
requireMigration
If true, Room should crash if a migration is missing. |
public
final
SupportSQLiteOpenHelper.Factory |
sqliteOpenHelperFactory
The factory to use to access the database. |
public
final
Executor |
transactionExecutor
The Executor used to execute asynchronous transactions. |
Public methods | |
---|---|
boolean
|
isMigrationRequired(int fromVersion, int toVersion)
Returns whether a migration is required between two versions. |
boolean
|
isMigrationRequiredFrom(int version)
This method is deprecated.
Use |
Inherited methods | |
---|---|
Fields
allowDestructiveMigrationOnDowngrade
public final boolean allowDestructiveMigrationOnDowngrade
If true, Room should perform a destructive migration when downgrading without an available migration.
allowMainThreadQueries
public final boolean allowMainThreadQueries
Whether Room should throw an exception for queries run on the main thread.
copyFromAssetPath
public final String copyFromAssetPath
The assets path to a pre-packaged database to copy from.
copyFromFile
public final File copyFromFile
The pre-packaged database file to copy from.
migrationContainer
public final RoomDatabase.MigrationContainer migrationContainer
Collection of available migrations.
multiInstanceInvalidation
public final boolean multiInstanceInvalidation
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
public final String name
The name of the database file or null if it is an in-memory database.
queryExecutor
public final Executor queryExecutor
The Executor used to execute asynchronous queries.
requireMigration
public final boolean requireMigration
If true, Room should crash if a migration is missing.
sqliteOpenHelperFactory
public final SupportSQLiteOpenHelper.Factory sqliteOpenHelperFactory
The factory to use to access the database.
transactionExecutor
public final Executor transactionExecutor
The Executor used to execute asynchronous transactions.
Public methods
isMigrationRequired
public boolean isMigrationRequired (int fromVersion, int toVersion)
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
public boolean isMigrationRequiredFrom (int version)
This method is 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. |
Returns | |
---|---|
boolean |
True if a valid migration is required, false otherwise. |