Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CoreData migration & data mapping: creating a new entity from existing attribute

I really hope someone will be able to help me out with this. I am trying to create a data mapping model (for an iOs app) in Xcode for the first time.

This should be a very simple migration (although not covered by lightweight migration); here is 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 to-many relationship. I would like to move the old database's DBreminder (NSDate) attribute to the new DBreminderDate. Both attributes in the new table are optional.

So basically I only need to copy data from one attribute, which now resides in a new entity.

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

like image 710
antalkerekes Avatar asked Feb 25 '23 11:02

antalkerekes


1 Answers

I have sold this problem using a great description found here.

Update: (Fixed link to what appears to be the same blog post)

Here is the working mapping model:

DB mapping model #1DB mapping model #2

I hope it helps someone.

like image 184
antalkerekes Avatar answered May 01 '23 08:05

antalkerekes