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:
Bruno Deanoz 2026-06-22 00:53:30 +02:00
parent f22838e99a
commit 6a8a76d9f8

View file

@ -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 }
} }