Core Data migrations
Migrations are how Core Data helps developers adapt their data models to changing requirements. As applications evolve, it is often needed to change the data model; however, existing users will have their data stored in an old format. A Core Data migration helps move this old data into a new updated data model without losing vital information.
Core Data allows three types of migration:
- Lightweight migration: The simplest migration, which is almost automatic. It is achievable only if the database changes are minor, such as adding or removing one attribute, or changing an attribute status between mandatory and optional.
- Staged migration: This migration is more complex and required for more complex changes, such as renaming an attribute or changing data types or relationships.
- Manual migration: This is used when you need to perform complex transformations on data that cannot be covered by staged and lightweight migrations.
To prepare to migrate...