Updating core data database
Lightweight migration is Apple’s term for the migration with the least amount of work involved on your part.
This happens automatically when you use , or you have to set some flags when building your own Core Data stack.
There are some limitations on how much you can change the data model, but because of the small amount of work required to enable this option, it’s the ideal setting.
Manual migrations involve a little more work on your part.
You’ll need to specify how to map the old set of data onto the new set, but you get the benefit of a more explicit mapping model file to configure.
Setting up a mapping model in Xcode is much like setting up a data model, with similar GUI tools and some automation. You’ll still use a mapping model, but complement that with custom code to specify custom transformation logic on data.
If the store’s model version and the coordinator’s model version don’t match, Core Data will perform a migration, when enabled.
To start the migration process, Core Data needs the original data model and the destination model.
That said, any time it’s impossible to implement a design change or feature request without changing the data model, you’ll need to create a new version of the data model and provide a migration path.However, after you ship your app inevitably you’ll want to make changes to your data model. You don’t want to break the app for existing users!You can’t predict the future, but with Core Data, you can migrate toward the future with every new release of your app.First, Core Data analyzes the store’s model version.Next, it compares this version to the coordinator’s configured data model.
Search for updating core data database:
You’ll start with a simple app with only a single entity in its data model. If an app is using Core Data merely as an offline cache, when you update the app, you can simply delete and rebuild the data store.