Problem
- I have 13 versions of my underlying data model.
- I created 13 matching models (V1-V2, V2-V3, etc.)
- I have automatic migration enabled.
- When migrating between two consecutive versions (e.g. V12-V13) the migration works fine
When migrating between two inconsistent versions (for example, V11-V13), the migration fails:
Can't find mapping model for migration
What i tried
Create a display model for each possible combination of versions. It works, but it's a real hassle.
For version 14, I will need to make 14 different matching models. Manually. Ugh.
the code
Here are the parameters I pass in for the transfer:
[persistentStoreCoordinator addPersistentStoreWithType:[self storeType] configuration:nil URL:url options:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:NO], NSReadOnlyPersistentStoreOption, nil] error:&error]){
Data model
My data model is pretty complicated, but here it is: http://dl.dropbox.com/u/136780/Engine_V2_DataModel.xcdatamodeld.zip
I do not use version hash modifiers or rename identifiers in my data model right now.
source share