I have two apps which talk to the same API. As they've grown, they've each taken on more of the API's features, and I'm now at the stage where they're identical except for the arrangement of the starting controllers.
Their core data models have so far been maintained separately, containing only those entities which they needed; but I'd now like to use the same data model versions for each one. However, their latest versions do differ in some small ways, especially in the deletion rules of some of the relationships.
If I change a deletion rule from Nullify
to Cascade
or vice versa between versions, will I still be able to perform a lightweight migration? It's not mentioned in Apple's web page, though it does list similar steps as being compatible (e.g. to-one <-> to-many)
Yes. In fact if changing the delete rule were the only change, you wouldn't even need to do migration.
Some explanation of that: Migration is only necessary if the version hash changes. The version hash only considers details that affect how data is saved in the persistent store. If you look up versionHash
on NSRelationshipDescription
, the only things it adds are "...the name of the destination entity and the inverse relationship, and the min and max count." Delete rules don't matter to the version hash, so they don't matter to migration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With