Re: Versioning and CoreData
Re: Versioning and CoreData
- Subject: Re: Versioning and CoreData
- From: Ryan Britton <email@hidden>
- Date: Tue, 2 May 2006 06:11:09 -0700
On May 2, 2006, at 3:11 AM, Uli Kusterer wrote:
Great solution to a horrible problem. Is there no way to have
CoreData do the copying based on the model file and just add the
model's default values for any new items? I had hoped there was an
easier way for the migration.
Core Data can handle defaults, but it cannot handle any of the
copying. If you have an acceptable default value for an added
attributes, then you do not need to necessarily set these in the
migration because Core Data will handle that part. Existing
attributes must be copied directly though. Fortunately, you can get
a list of these and iterate over them rather than having to hard code
them in.
This currently has a few limitations. Namely, it does not support
an entity type disappearing. If that happens, it will ignore the
old objects of that entity type and will not attempt to migrate
them. If you're at all interested, I'm more than willing to share
the code though it is still a work in progress and not necessarily
ready for every scenario.
I may get back to you on that. I just got swamped in more work,
but once that's done I'd love to give it a try. Maybe I can somehow
get the info from the model file and automate the migration step
some more with the defaults in there.
There is one other limitation that I didn't mention here. Store size
plays a factor. This currently does no batching so large store sizes
may not be practical without adding some kind of batching
functionality. My data sets have been small so I've not done
anything like this.
Ryan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden