user387184
user387184

Reputation: 11053

core data migration - how to fill just one new object?

I have an app on the market which has just one object instance a1 of class A in core data.

In the new version I now need 2 instances b1, b2 of a new class B,and 2 instances c1, c2 of new class C. here b1 and c1 get most data from old a1 while b2 and c2 have to be created but left empty - so do not get data from the old core data object.

All tutorials and descriptions elaborate on data transformation old -> new, but in my case its about this migration from old data to new including creating the new empty objects.

What would be the correct way to do this, since "typical migration" does not really cover this case?

I did the same in Android with my database, there it is really easy but I am not sure how to "press" my problem into core data migration scheme.

many Thanks!

Upvotes: 0

Views: 109

Answers (1)

mprivat
mprivat

Reputation: 21902

You have to create a custom migration policy. Use this post as a guideline to get started and get a good starting point for researching the docs.

Core Data versioning and migrating with custom policy

Upvotes: 1

Related Questions