diff --git a/SessionMessagingKit/Database/Migrations/_011_SharedUtilChanges.swift b/SessionMessagingKit/Database/Migrations/_011_SharedUtilChanges.swift index 8206068f5..605dfe8d1 100644 --- a/SessionMessagingKit/Database/Migrations/_011_SharedUtilChanges.swift +++ b/SessionMessagingKit/Database/Migrations/_011_SharedUtilChanges.swift @@ -2,6 +2,7 @@ import Foundation import GRDB +import SessionUtil import SessionUtilitiesKit /// This migration recreates the interaction FTS table and adds the threadId so we can do a performant in-conversation @@ -9,7 +10,7 @@ import SessionUtilitiesKit enum _011_SharedUtilChanges: Migration { static let target: TargetMigrations.Identifier = .messagingKit static let identifier: String = "SharedUtilChanges" - static let needsConfigSync: Bool = false + static let needsConfigSync: Bool = true static let minExpectedRunDuration: TimeInterval = 0.1 static func migrate(_ db: Database) throws { @@ -21,7 +22,18 @@ enum _011_SharedUtilChanges: Migration { .notNull() } - // TODO: Create dumps for current data + // Create a dump for the user profile data + let userProfileConf: UnsafeMutablePointer? = try SessionUtil.loadState( + for: .userProfile + ) + let confResult: SessionUtil.ConfResult = try SessionUtil.update( + conf: userProfileConf, + with: Profile.fetchOrCreateCurrentUser(db) + ) + + if confResult.needsDump { + try SessionUtil.saveState(db, conf: userProfileConf, for: .userProfile) + } Storage.update(progress: 1, for: self, in: target) // In case this is the last migration }