Timeline rework: make sure migration doesn't crash

This commit is contained in:
ganfra 2021-09-20 18:33:43 +02:00
parent b370f84e08
commit cd1da7348f
1 changed files with 3 additions and 1 deletions

View File

@ -344,7 +344,9 @@ internal object RealmSessionStoreMigration : RealmMigration {
private fun migrateTo18(realm: DynamicRealm) {
Timber.d("Step 17 -> 18")
realm.schema.get("ChunkEntity")?.apply {
removeField("numberOfTimelineEvents")
if (hasField("numberOfTimelineEvents")) {
removeField("numberOfTimelineEvents")
}
var cleanOldChunks = false
if (!hasField(ChunkEntityFields.NEXT_CHUNK.`$`)) {
cleanOldChunks = true