From 22e8e659e438caa6c66a1c82f7a89525382a9b93 Mon Sep 17 00:00:00 2001 From: Davide Date: Sun, 17 Nov 2024 11:40:49 +0100 Subject: [PATCH] Discard old profiles once migrated (#884) Otherwise, they would reappear if the migrated profiles are deleted from the new store. --- .../Sources/AppUIMain/Views/Migration/MigrateView.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateView.swift b/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateView.swift index 8bdc41f3..50e81448 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateView.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/Migration/MigrateView.swift @@ -190,6 +190,12 @@ private extension MigrateView { model.statuses[$0.id] == .done } pp_log(.App.migration, .notice, "Migrated \(migrated.count) profiles") + do { + try await migrationManager.deleteMigratableProfiles(withIds: Set(migrated.map(\.id))) + pp_log(.App.migration, .notice, "Discarded \(migrated.count) migrated profiles from old store") + } catch { + pp_log(.App.migration, .error, "Unable to discard migrated profiles: \(error)") + } model.step = .migrated(migrated) } catch { pp_log(.App.migration, .error, "Unable to migrate profiles: \(error)")