I have a very simple question related to the usage of lightweight migration and Core Data versioning.
It is well known that when modifying Core Data model one needs to ensure that a transition can occur from the old model to the new one.
For simple changes (like adding a new attribute) lightweight migration is all that is needed. There is lots of information online suggesting that to ensure that all works well one needs to:
- Create new model version
- Make the necessary modification
- Assign the modified version as the new current version
Support lightweight migration with the options:
let options = [NSMigratePersistentStoresAutomaticallyOption:true,NSInferMappingModelAutomaticallyOption:true]
This approach definitely works well. However, I have also discovered that for simple changes a new model version is not needed. In one of my apps I have already released several updates which included changes to Core Data model (all of them contained additions of new attributes) and lightweight migration was successfully applied without any new model versions.
From my experience it seems that when one modifies Core Data version it is assigned a new identifier of some kind. Then, when this version is launched on the phone which has an older version of this model, lightweight migration is performed without any issues for simple changes.
However, in the light of the fact that every tutorial suggests to create a new model version can someone tell me if I am missing some scenario under which my approach will result in the crash?