Migrating our data to a new schema
Data migration is not a weird expression for those who have worked with Core Data. It is obvious that we need to change our schema as our app evolves.
There are two types of migrations – lightweight and custom migration. With lightweight migration, we perform changes that don’t require custom logic. For example, adding an entity, a property, and a relationship are all good examples of lightweight migration. Conversely, changing a property type, making a property unique, and creating a new property based on other properties are examples of custom migrations. Now that we know what migration types we have, it’s important to understand when it is relevant to perform a migration.
When we’re in our development stage, migration is unnecessary before we have an official version of our app on the App Store. We only need to perform migration when an end user holds a version with an older schema. This also means that if we perform...