|
|
@ -50,13 +50,13 @@ abstract class AppDatabase : RoomDatabase() { |
|
|
|
|
|
|
|
|
|
|
|
private const val DATABASE_NAME = "legado.db" |
|
|
|
private const val DATABASE_NAME = "legado.db" |
|
|
|
|
|
|
|
|
|
|
|
fun createDatabase(context: Context) = |
|
|
|
fun createDatabase(context: Context) = Room |
|
|
|
Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME) |
|
|
|
.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME) |
|
|
|
.fallbackToDestructiveMigrationFrom(1, 2, 3, 4, 5, 6, 7, 8, 9) |
|
|
|
.fallbackToDestructiveMigrationFrom(1, 2, 3, 4, 5, 6, 7, 8, 9) |
|
|
|
.addMigrations(*DatabaseMigrations.migrations) |
|
|
|
.addMigrations(*DatabaseMigrations.migrations) |
|
|
|
.allowMainThreadQueries() |
|
|
|
.allowMainThreadQueries() |
|
|
|
.addCallback(dbCallback) |
|
|
|
.addCallback(dbCallback) |
|
|
|
.build() |
|
|
|
.build() |
|
|
|
|
|
|
|
|
|
|
|
private val dbCallback = object : Callback() { |
|
|
|
private val dbCallback = object : Callback() { |
|
|
|
|
|
|
|
|
|
|
|