Re: MOC Migrations Using .xcdatamodeld
Re: MOC Migrations Using .xcdatamodeld
- Subject: Re: MOC Migrations Using .xcdatamodeld
- From: Jerry Krinock <email@hidden>
- Date: Sun, 15 Aug 2010 19:42:29 -0700
On 2010 Aug 13, at 12:08, Brad Gibbs wrote:
> I'm having some real problems performing my first migration.
I've been looking at your post for a couple days but haven't yet found time to study it in detail, which is what it would take, and I probably wouldn't know the answers either. So I'll just offer the advice that Core Data migration quickly becomes nontrivial if you get off the beaten path, not many people have been there, and Apple's Core Data Programming Guide doesn't give much detail. I noticed last week that Marcus Zarra's book has 20 pages (Chapter 5) on Versioning and Migration, and I'll probably buy it next time I have a Core Data migration problem I can't solve.
http://pragprog.com/titles/mzcd/core-data
> 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.
_______________________________________________
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