Skip to content

Commit d75bb91

Browse files
Delete Realm Content DB at 17th migration
1 parent ed8cc6f commit d75bb91

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

app/src/main/java/com/infomaniak/mail/data/cache/RealmMigrations.kt

+3-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ val MAILBOX_INFO_MIGRATION = AutomaticSchemaMigration { migrationContext ->
3434
val MAILBOX_CONTENT_MIGRATION = AutomaticSchemaMigration { migrationContext ->
3535
SentryDebug.addMigrationBreadcrumb(migrationContext)
3636
migrationContext.deleteRealmAt1stMigration()
37-
migrationContext.resetFoldersCursor()
37+
migrationContext.deleteRealmAt17thMigration()
3838
}
3939

4040
// Migrate to version #1
@@ -43,10 +43,6 @@ private fun MigrationContext.deleteRealmAt1stMigration() {
4343
}
4444

4545
// Migrate to version #17
46-
private fun MigrationContext.resetFoldersCursor() {
47-
if (oldRealm.schemaVersion() < 17L && newRealm.schemaVersion() >= 17L) {
48-
oldRealm.query(className = "Folder").find().forEach {
49-
newRealm.findLatest(it)?.set(propertyName = "cursor", value = null)
50-
}
51-
}
46+
private fun MigrationContext.deleteRealmAt17thMigration() {
47+
if (oldRealm.schemaVersion() < 17L && newRealm.schemaVersion() >= 17L) newRealm.deleteAll()
5248
}

0 commit comments

Comments
 (0)