Re: Chained Migration of Leopard CoreData stores
Re: Chained Migration of Leopard CoreData stores
- Subject: Re: Chained Migration of Leopard CoreData stores
- From: Ruotger Skupin <email@hidden>
- Date: Thu, 17 Apr 2008 14:29:41 +0200
Am 17.04.2008 um 02:30 schrieb Ben Trumbull:
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.
fair enough. But when releasing a version n of my app I'd rather have
have the cost O(1) than O(n) building mappings.
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.
Ok, let's say I'm confident. Two questions:
- How do I find out what data model my store uses? (So that I know
where to start)
- How do I find out which two data models correspond to a given
mapping? (So that I know which data model and mapping to use next)
Ruotger
_______________________________________________
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