Re: Core Data migration, what to do when adding the nth version of your model?
Re: Core Data migration, what to do when adding the nth version of your model?
- Subject: Re: Core Data migration, what to do when adding the nth version of your model?
- From: Jerry Krinock <email@hidden>
- Date: Sun, 08 Apr 2012 16:58:17 -0700
On 2012 Apr 04, at 16:40, Sean McBride wrote:
> How do I update my existing .xcmappingmodels to point to version 4 instead of 3?
>
> When viewing the xcmappingmodel in Xcode 4, should I use the 'destination' popup and change it from 3 to 4? After doing so, and diffing its xcmapping.xml, I see the "destinationmodelpath" changes in the expecting way, and one big blob also changes. hmmmm, scary.
I don't know if that would work or not. In Xcode 3, there is a menu item…
Design ▸ Data Model ▸ Update Destination Model
which is probably necessary to do. You'll have to find where it got moved to in Xcode 4.
> Thanks for any help,
Now that you've got 4 versions you need to test 3 mapping models :( A couple years ago I wrote a class which, instead, migrates serially until it reaches the current version. Really old documents take a long time to migrate, but I feel that's a fitting punishment for users who have been lax in updating. It's exciting to watch it grind for 2 minutes and then succeed. Another disadvantage is that my code digs into the .momd bundle's VersionInfo.plist and reads some key/values, which is unsupported as far as I know. But I've never had any trouble with it.
https://github.com/jerrykrinock/ClassesObjC/blob/387db9d380fc78c86bb87b61cfa165d53f6bb5ab/SSYPersistentDocumentMultiMigrator.h
Also, it has some dependencies on other sources which you'd have to dig out of my github. Maybe someone else has published a better implementation.
_______________________________________________
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