I’ve found nothing about migration rules in case of changing the deletion rule of a managedObjects relationship
My initial coredata model contained an entity with a relationship. The delete rule of this relationship was cascade. I had to change this behavior to Nullify.
Therefore I’ve created a new version of my coredata model but without any lightweight migration and it still works. So I wounder if I should have done adding a new version of my model or if the changing the deletion rules (e.g. from cascade to nullify) doesn’t effect/need any migration.
Any suggestions?
Deletion rules specify the behavior of Core Data at runtime: If one object is deleted, other relationships may be set to NULL, or related objects may be deleted as well.
Therefore I assumed that the deletion rules are stored only in the Core Data model, but not in the persistent store file.
To verify this, I have created 2 store files from 2 Core Data models with identical entities, but different deletion rules. The
NSStoreModelVersionHashesin the persistent storesmetadatadictionary were identical.In fact, both SQLite files were identical with the only exception of the “Z_UUID” in the “Z_METADATA” table, which is the
NSStoreUUIDof the persistent store file.Also,
addPersistentStoreWithType:...would fail if the version hashes of the loaded store are different from the hashes in the model.Changing the deletion rules should therefore not be a problem.