From 65efc96e12c1a8a5fd9242dbcbb5bb1ad5ef2ca5 Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Tue, 26 Sep 2023 11:30:46 +0200 Subject: [PATCH] fix: Correctly migrate SearchHistory --- MailCore/Cache/MailboxManager/MailboxManager.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MailCore/Cache/MailboxManager/MailboxManager.swift b/MailCore/Cache/MailboxManager/MailboxManager.swift index 3d33f9e82..1cff33ce1 100644 --- a/MailCore/Cache/MailboxManager/MailboxManager.swift +++ b/MailCore/Cache/MailboxManager/MailboxManager.swift @@ -67,13 +67,16 @@ public final class MailboxManager: ObservableObject, MailboxManageable { let realmName = "\(mailbox.userId)-\(mailbox.mailboxId).realm" realmConfiguration = Realm.Configuration( fileURL: MailboxManager.constants.rootDocumentsURL.appendingPathComponent(realmName), - schemaVersion: 19, + schemaVersion: 20, migrationBlock: { migration, oldSchemaVersion in // No migration needed from 0 to 16 if oldSchemaVersion < 17 { // Remove signatures without `senderName` and `senderEmailIdn` migration.deleteData(forType: Signature.className()) } + if oldSchemaVersion < 20 { + migration.deleteData(forType: SearchHistory.className()) + } }, objectTypes: [ Folder.self,