• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
re: Chained Migration of Leopard CoreData stores
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: Chained Migration of Leopard CoreData stores


  • Subject: re: Chained Migration of Leopard CoreData stores
  • From: Ben Trumbull <email@hidden>
  • Date: Wed, 16 Apr 2008 17:30:04 -0700

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 (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


  • Follow-Ups:
    • Re: Chained Migration of Leopard CoreData stores
      • From: Ruotger Skupin <email@hidden>
  • Prev by Date: Re: Drawing a 1 pixel-perfect wide bordered NSBezierPath
  • Next by Date: Core Animation/Layers and Borderless Windows
  • Previous by thread: Chained Migration of Leopard CoreData stores
  • Next by thread: Re: Chained Migration of Leopard CoreData stores
  • Index(es):
    • Date
    • Thread