Tom,
The data store doesn't have a copy of the model in it, it just has hashes that 
are used to quickly compare the store to the data model trying to open it. In 
order for migration to work you will need to have both the old and new data 
models. In lightweight migrations Core Data uses the two versions to work out 
the differences between them and in the heavier styles it actually builds the 
old stack and carries the data over to the new stack a piece at a time.  

As you move forward with your application you will need to keep every data 
model in it from any version you release so that Core Data can get from any 
older version of the model to whatever is the current version. Depending on how 
often up change the model building all of those models each time your app 
launches may turn into a non-trivial amount of time down the road.

Hope this helps,
Mike Swan
http://www.theMikeSwan.com



"The Ego is the little self that pretends to be the only self and speaks so 
loudly that the still, small voice of the Greater Self, whose whisperings come 
from within the Soul, are rarely heard - unless we learn to listen."



On Feb 25, 2013, at 8:36 AM, cocoa-dev-requ...@lists.apple.com wrote:

> Message: 9
> Date: Mon, 25 Feb 2013 07:27:03 -0600
> From: tshanno <tsha...@icloud.com>
> To: Cocoa Dev List <cocoa-dev@lists.apple.com>
> Subject: Programmatic Core Data Migration
> Message-ID: <aad1c366-59ae-49a6-8bdb-a430092dc...@icloud.com>
> Content-Type: text/plain; charset=us-ascii
> 
> I'm at an early stage of developing my application and up to this point 
> whenever I've made a changes to the core data model, I've simply trashed the 
> old one and reimported default data.  However I'm now at a point where I'd 
> like to begin using the thing and, as a result, I want to keep the old data 
> and use core data versioning and migration.  I can't imagine that lightweight 
> migration won't be fine for whatever changes I make from here on out.
> 
> Many will think it foolish, I suppose, but I generated my object model 
> completely programmatically.  That is, I didn't use interface builder.  
> Unfortunately, as far as I can tell, the information and instructions in the 
> Core Data Model Versioning and Data Migration Programming Guide seem to 
> assume that you did use interface builder and, therefore, suggest you create 
> a new version of the model using Editor ->  Add Model Version.  I could do 
> this but, of course, I'd simply have two blank graphs. :)
> 
> So it isn't entirely clear to me what I should do here.  Should I simply 
> simply alter the version I have in my code, add the necessary options for 
> lightweight migration?  Xcode will therefore have the new version in code and 
> the old version indirectly in the form of the old persistent store.  Is that 
> all it needs?
> 
> Thanks for any help here.
> 
> Tom S.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to