今天我看到了一个错误: 需要从[n]迁移到[n+2],但未找到
问:当我已经切换到新版本时,我应该保留自动迁移的线路吗?带有数据库模式的JSON文件是否打包为APK和/或AAB?
这样写就够了吗?
@Database(
entities = [Setting::class, ProfileModel::class, EventsClicks::class],
version = 5,
autoMigrations = [
AutoMigration(from = 4, to = 5)
]
)
或者我应该一直这样写?
@Database(
entities = [Setting::class, ProfileModel::class, EventsClicks::class],
version = 5,
autoMigrations = [
AutoMigration(from = 1, to = 2),
AutoMigration(from = 2, to = 3, spec = AppDatabase.MyAutoMigration::class),
AutoMigration(from = 3, to = 4),
AutoMigration(from = 4, to = 5)
]
)
在https://developer.android.com/training/data-storage/room/migrating-db-versions上没有这样的信息,许多其他指南也没有.你能帮我理解一下吗?