Can I change the rule for deleting a master data relationship and perform a light migration?

I have two apps that talk to the same API. As they have grown, they each use more of the APIs, and now I am at the same level as they are, except for the location of the launch controllers.

Their core data models have so far been maintained separately, containing only the objects they need; but now I would like to use the same versions of the data model for each one. However, their latest versions differ in small ways, especially in the rules for deleting some of the relationships.

If I change the delete rule from Nullify

to Cascade

or vice versa between versions, can I still do a light migration? It is not mentioned in Apple's webpage , although it lists similar steps as compatible (e.g. one-one ↔ for many)


source to share

1 answer

Yes. In fact, if the change to the delete rule was the only change, you wouldn't even need to migrate.

Some explanations for this: Migration is only needed if the version hash changes. The hash version only considers data that affects persistence of the data. If you look versionHash

at NSRelationshipDescription

, the only thing it adds is "... the target name and feedback, and the min and max counter". The delete rules don't matter for the hash version, so they don't matter for migration.



All Articles