How to "merge" Core Data configurations?
Asked Answered
C

1

12

I'm using Core Data with MagicalRecord, my model has two configurations:

enter image description here

PrefilledConfiguration has four entities, UserDataConfigurations has six. Now I would like to merge them all in the default configuration - what's the best way to achieve that?

Is there a migration necessary? How can I transfer all existing data into the new, merged (default?) configuration?

Concoct answered 1/4, 2015 at 5:33 Comment(4)
Do your entities appear in multiple configurations?Wojak
each entity is either in PrefilledConfiguration or in UserDataConfiguration; none of them in bothConcoct
I tried a similar thing a while ago and failed. After successfully merging in some changes, the update path from an older version was completely broken. It did not give any error, but all user data was gone. I guess you will have to do it by hand and yes you will need an update script to migrate the data.Unlive
Did you manage to figure this out?Cottage
I
0

You can try edit you xcdatamodel file manually. Inside the package it is simple XML file. This is example from the my test xcdatamodel:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="7701" systemVersion="14D136" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
    <entity name="Entity" isAbstract="YES" syncable="YES"/>
    <entity name="Event">
        <attribute name="timeStamp" optional="YES" attributeType="Date">
            <userInfo/>
        </attribute>
        <userInfo/>
    </entity>
    <configuration name="Test"/>
    <elements>
        <element name="Event" positionX="261" positionY="189" width="128" height="60"/>
        <element name="Entity" positionX="261" positionY="198" width="128" height="45"/>
    </elements>
</model>
Interment answered 22/5, 2015 at 8:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.