Hello,
I have 3 model versions and I'm trying to step through migration.
Version 2 makes significant changes to v1. As a result, I've renamed the entities in question by appending _v2 to their name, as the data isn't important to retain.
v3, remove's the appended version number from v2.
Setting the .xcdatamodeld to v3 and the migrations steps array as follows causes the app to error
[
NSLightweightMigrationStage([v1]),
NSLightweightMigrationStage([v2]),
NSLightweightMigrationStage([v3]),
]
CoreData: error: <NSPersistentStoreCoordinator: 0x10740d680>: Attempting recovery from error encountered during addPersistentStore: 0x10770f8a0 Error Domain=NSCocoaErrorDomain Code=134110 "An error occurred during persistent store migration."
An error occurred during persistent store migration. Cannot merge multiple root entity source tables into one destination entity root table.
I find this odd because if I run the migration independently across app launches, the migration appears to drop the no longer used tables in v2, then re-add them back in v3. So it seems to me that something is not finishing completely with the fully stepped through migration.
--
I'm also unable to understand how to use NSCustomMigrationStage I've tried setting it to migrate from v1, to v2, but I'm getting a crash with error
Duplicate version checksums across stages detected