Skip to content

Commit

Permalink
Delete all the chunks in one step.
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Jun 27, 2022
1 parent d17152c commit e0b378e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ internal class MigrateSessionTo030(realm: DynamicRealm) : RealmMigrator(realm, 3
.equalTo(ChunkEntityFields.IS_LAST_FORWARD, false)
.findAll()

val nbOfDeletedChunks = chunks.size
var nbOfDeletedTimelineEvents = 0
var nbOfDeletedEvents = 0
chunks.forEach { chunk ->
Expand All @@ -49,8 +50,8 @@ internal class MigrateSessionTo030(realm: DynamicRealm) : RealmMigrator(realm, 3
}
nbOfDeletedTimelineEvents += timelineEvents.size
timelineEvents.deleteAllFromRealm()
chunk.deleteFromRealm()
}
Timber.d("MigrateSessionTo030: $nbOfDeletedTimelineEvents deleted TimelineEvent(s) and $nbOfDeletedEvents deleted Event(s).")
chunks.deleteAllFromRealm()
Timber.d("MigrateSessionTo030: $nbOfDeletedChunks deleted chunk(s), $nbOfDeletedTimelineEvents deleted TimelineEvent(s) and $nbOfDeletedEvents deleted Event(s).")
}
}

0 comments on commit e0b378e

Please sign in to comment.