mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Custom schema mapping with copyEntity fails with renaming ids #255
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 @iby on GitHub (Jan 13, 2019).
I'm coming across a case with custom mapping provider that fails due to use of renaming identifiers in source attributes. A simplified scenario:
oldFooattribute.newFooattribute withfooOldrenaming id for lightweight migration from v1.I believe it narrows down to CustomSchemaMappingProvider.swift#L425 line:
The call above to
cs_resolvedAttributeRenamingIdentities()returns source attributes dictionary organized by renaming id when they are present, or by name otherwise, but really should return them organized by attribute name only. In other words, instead of resolving renaming source attributes for v2 as["newFoo": …]it returns them as["oldFoo": …], but"oldFoo"isn't available in source entity v2.@iby commented on GitHub (Jan 13, 2019):
This also applies to
.transformEntity. The #301 PR addresses both cases. The current workaround is to use manual.transformEntitywith the following transformation block:@JohnEstropia commented on GitHub (Jan 15, 2019):
I'll comment on #301 if there's anything that comes up. Thanks again!