refactor: align AppDatabase code style with project conventions
This commit is contained in:
committed by
Nishant Mishra
parent
5ad7f5396e
commit
af899c06b4
@@ -17,7 +17,9 @@ import androidx.room.TypeConverters
|
|||||||
@Database(
|
@Database(
|
||||||
entities = [IntPreference::class, BooleanPreference::class, StringPreference::class, Stat::class],
|
entities = [IntPreference::class, BooleanPreference::class, StringPreference::class, Stat::class],
|
||||||
version = 2,
|
version = 2,
|
||||||
autoMigrations = [AutoMigration(from = 1, to = 2)]
|
autoMigrations = [
|
||||||
|
AutoMigration(from = 1, to = 2)
|
||||||
|
]
|
||||||
)
|
)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
@@ -33,7 +35,8 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
fun getDatabase(context: Context): AppDatabase {
|
fun getDatabase(context: Context): AppDatabase {
|
||||||
return Instance ?: synchronized(this) {
|
return Instance ?: synchronized(this) {
|
||||||
Instance ?: Room.databaseBuilder(context, AppDatabase::class.java, "app_database")
|
Instance ?: Room.databaseBuilder(context, AppDatabase::class.java, "app_database")
|
||||||
.build().also { Instance = it }
|
.build()
|
||||||
|
.also { Instance = it }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user