fix crash: bump Room version to 2, enable destructive migration
Room crashed on launch with schema hash mismatch because MessageEntity gained reasoning+sources fields but the DB version stayed at 1. fallbackToDestructiveMigration(false) only covered downgrades, not same-version schema changes. Fix: version 1→2, fallbackToDestructiveMigration(true) so any future schema change auto-wipes the cache (it's a read-cache, server is source of truth, rebuilds on next fetch).
This commit is contained in:
parent
f22838e99a
commit
6a8a76d9f8
1 changed files with 2 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ import androidx.room.TypeConverters
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
entities = [ConversationEntity::class, MessageEntity::class],
|
entities = [ConversationEntity::class, MessageEntity::class],
|
||||||
version = 1,
|
version = 2,
|
||||||
exportSchema = false,
|
exportSchema = false,
|
||||||
)
|
)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
|
|
@ -26,7 +26,7 @@ abstract class KaizenDatabase : RoomDatabase() {
|
||||||
KaizenDatabase::class.java,
|
KaizenDatabase::class.java,
|
||||||
"kaizen-cache",
|
"kaizen-cache",
|
||||||
)
|
)
|
||||||
.fallbackToDestructiveMigration(false)
|
.fallbackToDestructiveMigration(true)
|
||||||
.build()
|
.build()
|
||||||
.also { instance = it }
|
.also { instance = it }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue