diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index 5e0ebdd07..1f5bb7c87 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.kt @@ -39,11 +39,7 @@ abstract class AppDatabase : RoomDatabase() { // .addMigrations(MIGRATION_3_4) // .addMigrations(MIGRATION_4_5) // .addMigrations(MIGRATION_5_6) - .addCallback(object : Callback() { - override fun onCreate(db: SupportSQLiteDatabase) { - super.onCreate(db) - } - }) + .fallbackToDestructiveMigration() .build() } diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index 2ac3aea66..40a975434 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -10,7 +10,7 @@ import kotlinx.android.parcel.Parcelize @Parcelize @Entity( tableName = "book_sources", - indices = [(Index(value = ["sourceId"])), (Index(value = ["origin"], unique = false))] + indices = [(Index(value = ["origin"], unique = false))] ) data class BookSource ( @PrimaryKey diff --git a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt index 8f97640d2..1b2c793ff 100644 --- a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt @@ -20,10 +20,10 @@ class BookSourceAdapter : PagedListAdapter() { override fun areItemsTheSame(oldItem: BookSource, newItem: BookSource): Boolean = - oldItem.id == newItem.id + oldItem.origin == newItem.origin override fun areContentsTheSame(oldItem: BookSource, newItem: BookSource): Boolean = - oldItem.id == newItem.id + oldItem.origin == newItem.origin && oldItem.name == newItem.name && oldItem.group == newItem.group && oldItem.isEnabled == newItem.isEnabled