CoreData data migration and mapping: creating a new object from an existing attribute

I really hope someone can help me. I am trying to create a data mapping model (for iOs application) in Xcode for the first time.

This should be a very simple migration (although it is not covered by light migration); Here's what I originally had and what the new database looks like: before / after image of database model

What changed:

  • I have a new attribute ( DBdisplayOrder ) which is optional
  • I have a new attitude towards many. I would like to move the old DBreminder database DBreminder (NSDate) to the new DBreminderDate . Both attributes in the new table are optional.

So basically I only need to copy data from one attribute, which is now in the new object.

I would be very grateful if someone could point me in the right direction or just recommend a good resource to study and get started.

+4
source share
2 answers

I sold this problem using a great description here .

Update: ( Fixed link to what looks like a single blog post)

Here is a working mapping model:

DB mapping model # 1DB mapping model # 2

I hope this helps someone.

+8
source

Creating a matching model can be quite attractive. I would start with Core Data Programming and Data Migration Guide

In this particular case, you will need to create an explicit mapping model, then you will have to create entity mappings that describe both the source object and the new target object to which you want to move the attribute. Then create a property mapping for this particular attribute.

0
source

All Articles