pull/1251/head
gedoor 3 years ago
parent ed3ea2207f
commit 2d059e66f2
  1. 2
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  2. 2
      app/src/main/java/io/legado/app/data/DatabaseMigrations.kt

@ -51,7 +51,7 @@ abstract class AppDatabase : RoomDatabase() {
fun createDatabase(context: Context) = fun createDatabase(context: Context) =
Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME) Room.databaseBuilder(context, AppDatabase::class.java, DATABASE_NAME)
.fallbackToDestructiveMigration() .fallbackToDestructiveMigration()
.addMigrations(*DatabaseMigration.migrations) .addMigrations(*DatabaseMigrations.migrations)
.allowMainThreadQueries() .allowMainThreadQueries()
.addCallback(dbCallback) .addCallback(dbCallback)
.build() .build()

@ -4,7 +4,7 @@ import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase import androidx.sqlite.db.SupportSQLiteDatabase
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
object DatabaseMigration { object DatabaseMigrations {
val migrations: Array<Migration> by lazy { val migrations: Array<Migration> by lazy {
arrayOf( arrayOf(
Loading…
Cancel
Save