Core Data migration
Core Data migration
- Subject: Core Data migration
- From: "David Wilson" <email@hidden>
- Date: Sat, 29 Mar 2008 13:53:38 -0400
I have a reasonably complex core data data model which makes use of
entity inheritance. In an attempt to make use of the new Leopard data
migration tools, I created a new version, made a few minor desired
changes (added a few entities and created the relationships to them-
no changes to existing entities except new relationships to new
entities).
My first attempt to create the mapping model failed because the
automatically created mapping model would not compile. I eventually
tracked it down to the fact that mappings were not being created for
entities from which some other entity derived (that is, no base entity
had a mapping model created for it). As a result, any relationship to
a base entity did not have a valid value expression because no
appropriate mapping was found.
I was able to fix the above by creating the missing mappings, which
seemed to automatically fix the relationship mappings. Once I also got
the mapping and models into my application rather than its framework,
Core Data was successfully finding my source data model and attempting
the migration. However, the migration would fail with "Model already
contains an entity named VCText." The VCText entity is one that
derives from another entity, and it is my guess that this is a result
of a child entity being transformed twice- once because of the parent
entity mapping that I had to create, and then again because of the
child entity mapping.
To sum up:
Relationships to entities from which another entity inherits are not
automatically set up properly. There only appear to be two solutions:
a) Create the missing base entity mappings. This appears to cause
transformation failures, I assume because of double transformations
b) Fix the relationships by, rather than trying to use a base entity
mapping, simply picking one of the child entities (even though the
relationship is supposed to be to the base). This also seems likely to
fail to transform all relationships properly.
Anyone have any experience with this, or know how to handle this
situation? I suppose I could write a whole bunch of custom code to
handle it, but it seems as if the migration system should handle the
inheritance.
--
- David T. Wilson
Princeton Satellite Systems
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden