8

I've got about 4 different versions of my data model now, and every one except the last one has been just a minor change using automatic lightweight migration. For this latest model, I need to do a bit of additional work during the migration, so I created a custom mapping model and a migration policy subclass with some actions in the createDestinations and createRelationships. Problem is, my mapping model/custom policy isn't being called, and it seems that Core Data is trying to perform lightweight migration instead. Is there something I need to do to keep lightweight migration around, but use my mapping model when there's one available?

westsider
  • 4,967
  • 5
  • 36
  • 51
Cory Imdieke
  • 14,140
  • 8
  • 36
  • 46

1 Answers1

1

You have to change the way your PSC is being initialized. Try setting both NSInferMappingModelAutomaticallyOption and NSMigratePersistentStoresAutomaticallyOption to YES. See http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/CoreData/Articles/cdUsingPersistentStores.html

logancautrell
  • 8,762
  • 3
  • 39
  • 50
  • Also, you need a mapping model from each of the old versions to the new one, since the default migration process looks for a direct mapping model. Sad days. – Michael Oct 19 '11 at 20:45