|  |  | @ -1081,17 +1081,6 @@ export async function migrateSettings(): Promise<MigrationResult> { | 
			
		
	
		
			
				
					|  |  |  |     }); | 
			
		
	
		
			
				
					|  |  |  |     const platformService = PlatformServiceFactory.getInstance(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // Find the master settings (accountDid is null) which contains the activeDid
 | 
			
		
	
		
			
				
					|  |  |  |     const masterSettings = dexieSettings.find(setting => !setting.accountDid); | 
			
		
	
		
			
				
					|  |  |  |     let dexieActiveDid: string | undefined; | 
			
		
	
		
			
				
					|  |  |  |      | 
			
		
	
		
			
				
					|  |  |  |     if (masterSettings?.activeDid) { | 
			
		
	
		
			
				
					|  |  |  |       dexieActiveDid = masterSettings.activeDid; | 
			
		
	
		
			
				
					|  |  |  |       logger.info("[MigrationService] Found activeDid in Dexie master settings", { | 
			
		
	
		
			
				
					|  |  |  |         activeDid: dexieActiveDid, | 
			
		
	
		
			
				
					|  |  |  |       }); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // Create an array of promises for all settings migrations
 | 
			
		
	
		
			
				
					|  |  |  |     const migrationPromises = dexieSettings.map(async (setting) => { | 
			
		
	
		
			
				
					|  |  |  |       logger.info("[MigrationService] Starting to migrate settings", setting); | 
			
		
	
	
		
			
				
					|  |  | @ -1152,36 +1141,7 @@ export async function migrateSettings(): Promise<MigrationResult> { | 
			
		
	
		
			
				
					|  |  |  |     const updatedSettings = await Promise.all(migrationPromises); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // Step 2: Migrate the activeDid if it exists in Dexie
 | 
			
		
	
		
			
				
					|  |  |  |     if (dexieActiveDid) { | 
			
		
	
		
			
				
					|  |  |  |       try { | 
			
		
	
		
			
				
					|  |  |  |         // Verify that the activeDid exists in SQLite accounts
 | 
			
		
	
		
			
				
					|  |  |  |         const accountExists = await platformService.dbQuery( | 
			
		
	
		
			
				
					|  |  |  |           "SELECT did FROM accounts WHERE did = ?", | 
			
		
	
		
			
				
					|  |  |  |           [dexieActiveDid], | 
			
		
	
		
			
				
					|  |  |  |         ); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         if (accountExists?.values?.length) { | 
			
		
	
		
			
				
					|  |  |  |           // Update the master settings with the activeDid
 | 
			
		
	
		
			
				
					|  |  |  |           await updateDefaultSettings({ activeDid: dexieActiveDid }); | 
			
		
	
		
			
				
					|  |  |  |           logger.info("[MigrationService] Successfully migrated activeDid", { | 
			
		
	
		
			
				
					|  |  |  |             activeDid: dexieActiveDid, | 
			
		
	
		
			
				
					|  |  |  |           }); | 
			
		
	
		
			
				
					|  |  |  |           result.warnings.push(`Migrated activeDid: ${dexieActiveDid}`); | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |           logger.warn("[MigrationService] activeDid from Dexie not found in SQLite accounts", { | 
			
		
	
		
			
				
					|  |  |  |             activeDid: dexieActiveDid, | 
			
		
	
		
			
				
					|  |  |  |           }); | 
			
		
	
		
			
				
					|  |  |  |           result.warnings.push( | 
			
		
	
		
			
				
					|  |  |  |             `activeDid from Dexie (${dexieActiveDid}) not found in SQLite accounts - skipping activeDid migration`, | 
			
		
	
		
			
				
					|  |  |  |           ); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |       } catch (error) { | 
			
		
	
		
			
				
					|  |  |  |         logger.error("[MigrationService] Failed to migrate activeDid:", error); | 
			
		
	
		
			
				
					|  |  |  |         result.errors.push(`Failed to migrate activeDid: ${error}`); | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  |     } else { | 
			
		
	
		
			
				
					|  |  |  |       logger.info("[MigrationService] No activeDid found in Dexie settings"); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |     await migrateActiveDid(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     logger.info( | 
			
		
	
		
			
				
					|  |  |  |       "[MigrationService] Finished migrating settings", | 
			
		
	
	
		
			
				
					|  |  | @ -1467,18 +1427,6 @@ export async function migrateAll(): Promise<MigrationResult> { | 
			
		
	
		
			
				
					|  |  |  |     result.settingsMigrated = settingsResult.settingsMigrated; | 
			
		
	
		
			
				
					|  |  |  |     result.warnings.push(...settingsResult.warnings); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // Step 3: Migrate ActiveDid (depends on accounts and settings)
 | 
			
		
	
		
			
				
					|  |  |  |     logger.info("[MigrationService] Step 3: Migrating activeDid..."); | 
			
		
	
		
			
				
					|  |  |  |     const activeDidResult = await migrateActiveDid(); | 
			
		
	
		
			
				
					|  |  |  |     if (!activeDidResult.success) { | 
			
		
	
		
			
				
					|  |  |  |       result.errors.push( | 
			
		
	
		
			
				
					|  |  |  |         `ActiveDid migration failed: ${activeDidResult.errors.join(", ")}`, | 
			
		
	
		
			
				
					|  |  |  |       ); | 
			
		
	
		
			
				
					|  |  |  |       // Don't fail the entire migration for activeDid issues
 | 
			
		
	
		
			
				
					|  |  |  |       logger.warn("[MigrationService] ActiveDid migration failed, but continuing with migration"); | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |     result.warnings.push(...activeDidResult.warnings); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     // Step 4: Migrate Contacts (independent, but after accounts for consistency)
 | 
			
		
	
		
			
				
					|  |  |  |     // ... but which is better done through the contact import view
 | 
			
		
	
		
			
				
					|  |  |  |     // logger.info("[MigrationService] Step 4: Migrating contacts...");
 | 
			
		
	
	
		
			
				
					|  |  | 
 |