Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CoreData lightweight migration: which exactly are "simple changes to your model" which CoreData can migrate automatically?

I'd like to use CoreData lightweight migration as much as possible, but could not find in the documentation, which exactly are the cases when this is possible. The documentation says: If you just make simple changes to your model (such as adding a new attribute to an entity), on Mac OS X v10.6 and later and on iPhone OS, Core Data can perform automatic data migration.

For Core Data to be able to do this, the changes must fit an obvious migration pattern, for example:
- Simple addition of a new attribute
- A non-optional attribute becoming optional
- An optional attribute becoming non-optional, and defining a default value

Well, I tried out also adding a new entity without relationships and deleting an existing entity (without relationships) and that worked for me automatically as well.

The question is: does anybody know what exactly are the simple changes which can be migrated automatically?

like image 352
Arts Avatar asked Nov 29 '10 19:11

Arts


1 Answers

From WWDC 2010 Session 118 Mastering Core Data*:

Inferable Changes supported by lightweight migration

  • Add, remove, rename
  • Attributes - numerical type conversion
  • Relationships - promote to-one to to-many
  • Entities - change entity inheritance

*Video requires Apple Developer login

like image 154
Martin Brugger Avatar answered Oct 06 '22 01:10

Martin Brugger