How to refactor a core data model to make two existing entities inherit from a new abstract entity

前端 未结 2 753
无人及你
无人及你 2020-12-15 07:54

With this version of an iPhone app, I\'m trying to create a new core data model version in which I\'m taking two existing entities and changing them to inherit from a brand

2条回答
  •  爱一瞬间的悲伤
    2020-12-15 08:36

    Just to make sure people are doing this properly, I followed the instructions given by Christian Schlensker including "do not make one for the abstract Animal entity" and (to continue his example), while it built and ran without the original "Cannot merge" error, my Serpent and Rodent were not recognised as subclasses of Animal on introspection.

    In order to migrate properly I did have to create SnakeToAnimal and MouseToAnimal mappings which mapped the appropriate properties from subclass to superclass.

    This may be what Christian was getting at with Step 3, but it wasn't entirely clear to me given his comment "do not make one for the abstract Animal entity" previously, as this is exactly what I had to do.

提交回复
热议问题