mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
CoreStoreObject, Relations and migration #206
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SlinToWin on GitHub (Apr 23, 2018).
Hello,
i have a large CoreData Schema with round about 30 Entities and several relations. Implementation was done via CoreStoreObject
Now i want to add a property to one of my CoreStoreObjects.
Following the guide i created two Versions of my object, V1 and V2 and also created a typealias for the Name, so that i dont have to change all source files, where the object was used.
The Object has a relation to another CoreStoreObject. With this two Versions and the typealias, the build will fail because the inverse of the other CoreStoreObject cant be mapped to V1.
So i have to create also two versions for that one. This has relations to other Objects so i have to create also versions for that.
End of story is, that i have to create V2 for all 30 CoreStoreObjects, although only one object was changed because of the relations.
Is there any better way for doing that with CoreStoreObject (so that i just have to create Versions for Objects, which i really change?)
@JohnEstropia commented on GitHub (Apr 24, 2018):
In reality, relationship targets are also part of the data and will affect the versioning hash, so any updated entities will affect all related objects. How will an object know which version of it's relationship is it holding?
This replication is the same when you create a new version from an
xcdatamodeld; all entities are always reflected on the new versions. The solution is also as simple as howxcdatamodelddoes it:VersionLock)