Primary data migration between single-to-many relationships

I have a deployed application that selects measurements from sensors (e.g. Temp ° C, Pressure kPa). The user can create experiments and collect samples. Each sample is stored as Run, so there is a one-to-many relationship between experiment and run. In the interest of performance, Run has one relationship with the Data object (where the actual source data is stored); this allows you to load some launch attributes without having to load a lot of data.

Most of our sensors have several measurements, so it would be nice to store all the data that is actually sampled. But this means that the relation Run <---> Data must be Run ↔> Data (to use the Xcode convention).

I came across an attempt to transfer data from the old Run-to-One data model to the new Many Logs data model. Can this be done using Mapping Models? If so, does anyone have any examples? If not, does anyone have any examples of how to do this?

Thanks for any guidance or advice.

+3
source share
2 answers

NSEntityMigrationPolicy. , / . .

-addPersistentStoreType: configuration: URL: options: error: to:

    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                         [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, nil];

NSInferMappingModelAutomaticallyOption.

+1

, . , , , " ", .

+3

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


All Articles