Hi,

let's say I have four versions of my data model:

DataModel1.xcdatamodel
DataModel2.xcdatamodel
DataModel3.xcdatamodel
DataModel4.xcdatamodel (this is the current one)

and three model mapping files which always map from version n to version n+1:

Mapping1to2.xcmappingmodel
Mapping2to3.xcmappingmodel
Mapping3to4.xcmappingmodel


Now I load a version 1 data file:

NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSMigratePersistentStoresAutomaticallyOption];
NSError *error = nil;
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:options error:&error])
{
  ...
}

should the data file automatically be migrated to the current version 4 or do I need a single direct mapping like this:

Mapping1to4.xcmappingmodel

If you want Core Data to do everything, you'll need 1 mapping model, since we don't assume that iterative upgrades will necessarily work.

If you're confident that composing your N+1 mapping models together makes sense for your app, you can run N+1 migrations in a row to avoid needing an umbrella mapping model.
--

-Ben
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to