Master data migration - how to do it safely?

I have an application, and I want to release a new version.

The new version has a very small change in the Core Data model: adding the BOOL attribute ("hasUpdated") to the entity ("Users").

How do I migrate without crashing an application after updating (obviously) or modifying existing data?

+4
source share
1 answer

First, make sure that the data model you are using (with the new BOOL attribute) is different from the one you released. To create a new model, I believe that it is something like Editor -> Add Model Version - and then name it / tell me which model it will be based on.

Now set the new model as the current version in the utility panel. For help on this, you can read this entry: Xcode 4, master data model version — setting the current version

For such a simple change, you should be able to tell the persistent store to perform an easy migration. This post should explain that: Implementing "Easy Easy Migration" for Core Data (iPhone)

+3
source

Source: https://habr.com/ru/post/1369183/


All Articles