Core Data migration of to-one relationship to to-many relationship

Posted by westsider on Stack Overflow See other posts from Stack Overflow or by westsider
Published on 2010-05-04T23:53:00Z Indexed on 2010/05/04 23:58 UTC
Read the original article Hit count: 526

I have a deployed app that samples measurements from sensors (e.g., Temp °C, Pressure kPa). The user can create Experiments and collect samples. Each sample is stored as a Run, such that there is a one-to-many relationship from Experiment to Run. In the interest of performance, Run has a to-one relationship with Data entity (which is where the actual raw data is stored); this allows some Run attributes to be loaded without necessarily loading lots of data.

Most of our sensors have multiple measurements, so it would be nice to store all the data that is actually being sampled. But this means that the Run <---> Data relationship needs to become Run <-->> Data (to use Xcode's convention).

I am faced with trying to migrate data from old Run to-one Data model to new Run to-many Data model. Can this be done using Mapping Models? If so, does anyone have any pointers to examples? If not, does anyone have any pointers to examples of how to do that?

Thanks for any pointers or advice.

© Stack Overflow or respective owner

Related posts about core-data

Related posts about migration