I'm writing my first NSEntityMigrationPolicy right now and this one is pretty simple. It fetches a singleton from the DB and then churns through records of three other types and links them to the singleton for a new relationship that's been added to these classes.
Right now, I'm doing this in a single subclass of NSEntityMigrationPolicy in the endEntityMapping:manager:error:
method, which updates objects of all three types at once. The thing I'm unsure about is whether or not it's safe to do all of them at once, or whether I actually need to implement three separate policies ... it seems like the endEntityMapping
callback is called after all the migrations are done, and even if I set the mapping name into the "Custom Policy" field of all three classes in the mapping model editor, it only seems to be called once.
Just wanted to check whether or not doing everything in a single endEntityMapping
impl like this is safe? It certainly seems to be, but this is something I want to be sure about.
Thanks in advance for any help.
Didn't get a reply on this one, but for anyone stumbling over this in the future, it appears that no endEntityMapping
invocation is begun on any type in the data model until all the migrations have been done and the destination context is fully populated.