MOC Migrations Using .xcdatamodeld
MOC Migrations Using .xcdatamodeld
- Subject: MOC Migrations Using .xcdatamodeld
- From: Brad Gibbs <email@hidden>
- Date: Fri, 13 Aug 2010 12:08:16 -0700
I'm having some real problems performing my first migration. I'm trying to add a single attribute to two entities in my model.
I created a new version of the model using Design > Data Model > Add Model Version. This converted the .xcdatamodel into a .xcdatamodeld with two model versions. I renamed them to v1.xcdatamodel and v2.xcdatamodel. I set the new model as the current version using Design > Data Model > Set Current Version. I hit Build and Run and I'm getting an error message saying that it can't find the source data model.
I found a post by Adam Swift on August 21, 2008, which states:
If you want to use a model version bundle (xcdatamodeld) to group
versions of your data model, then you need to write code to find the
path for the source model, destination model and mapping model, then
call the migration manager directly to perform the migration
Is this still true? I used the code he provided and was able to make the migration happen, but, it seems like it's going to be a big hassle to update this code each time I make a change to the model that necessitates a new model version.
If it makes a difference, I have 4 different models in the project. So, I'm using -modelByMergingModels rather than -mergedModelFromBundle.
Thanks in advance.
Brad
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden