Tuesday, November 24, 2009

CoreData Lightweight Migration

I have been dreading my CoreData migration for a while now. I just jumped into the documenation and found this little chestnut.

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
    [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
    [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, nil];
I added the new models and attributes to my model. No data needed to be migrated across entities and no entities or attributes needed to be renamed. Viola, easy migration. Phew.

No comments: