[Core Data] Problem when versioning with two models
Hi there,
I'm having some trouble with CoreData.
At the time I created my app, I chose to create two stores, based on two different models:
- Store_1 with Model_1
- Store_2 with Model_2
However, I didn't quite understand all the underlying concepts behind CoreDate, which made me make a mistake : when creating the corresponding
NSManagedObjectModels I did the following:
- ManagedObjectModel_1 = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
- ManagedObjectModel_2 = [[NSManagedObjectModel mergedModelFromBundles:nil] retain];
I followed tutorials found on the internet, but it appears it was a bad idea, because Xcode merged the two bundle models in each managedObjectModel, hence creating two separate stores with the same model.
I understood that when I tried to upgrade Model_1 : in order to preserve user data, I decided to use versioning, which crashed because the new merged model was different from the one used to create the store.
Now, I'm totally unable to migrate Store_1 toward Model_1_v2 (No pb w/ Store_2 which I can delete and recreate with the correct model).
I tried to "manually" merge the two original models, and then managed to open Store_1, but now I can't create a mappingModel :-((
Any idea ?
it's a huge pain in the a.. considering I just want to tranform an integer 16 in integer 32 (which was a second mistake), and lightweight migration won't work.
Heeeeelp :-/
|