Yes, if you want the file deleted you have to do it yourself. There are 
certainly cases where you would not want to delete the file. For example for a 
document, the user may want to keep that archive around in case they need to 
revert to a previous version of the app, or share it with someone else. In that 
case, they should be informed when the file is going to be migrated, and they 
should be the one to delete the old version.

You can check whether the store needs to be migrated using 
-[NSManagedObjectModel isConfiguration:compatibleWithStoreMetadata:]; first get 
the current model and then check whether it is compatible with metadata from 
the store you want to open.

Lightweight migration also cannot handle all types of model changes. So, when 
you start to support multiple model versions, it might be a good idea to check 
if you *can* migrate from version x to version y using +[NSMappingModel 
inferredMappingModelForSourceModel:destinationModel:error:]. You may end up 
with cases where you have to use your own mapping model for some migrations.

Dave

On 2011-07-21, at 8:31 AM, Roland King wrote:

> I suppose I had to get to core data migration one day … :(
> 
> I've read the documentation a couple of times and it says that the default 
> migration process finishes by renaming the old store to the same thing with a 
> tilde prefix. Does that mean you, the programmer, are responsible for 
> deleting it again afterwards or is there a piece I've missed where eventually 
> it does get cleaned up? I was thinking that if you use automatic migration, 
> you don't even know when the store has been migrated and that you should thus 
> go look for a tilde version and remove it. If that's the case I wondered how 
> many apps have upgraded their core data stores and left the old one sitting 
> there taking up the same amount of space. 
> _______________________________________________
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca
> 
> This email sent to dave.fernan...@utoronto.ca

_______________________________________________

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

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

Reply via email to