The Problem
- I've got 13 versions of my core data model.
- I've made 13 mapping models (V1-V2, V2-V3 etc)
- I've got automatic migration switched on.
- On migration between two consecutive versions (e.g. V12-V13) the migration works perfectly
On migration between two non-consecutive versions (e.g. V11-V13) the migration fails with the error:
Can't find mapping model for migration
What I've tried
Creating a mapping model for every possible combination of versions. This works, but it's a real hassle.
For version 14 I'll need to make 14 different mapping models. Manually. Ugh.
Code
Here's the options I pass in for migration:
[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 complex, but here it is: http://dl.dropbox.com/u/136780/Engine_V2_DataModel.xcdatamodeld.zip
I'm not using any version hash modifiers or renaming identifiers in my data model right now.