Re: CoreData abstract entity migration issue
Re: CoreData abstract entity migration issue
- Subject: Re: CoreData abstract entity migration issue
- From: "email@hidden" <email@hidden>
- Date: Mon, 23 Nov 2009 10:50:43 +0000
On 22 Nov 2009, at 21:59, Quincey Morris wrote:
> On Nov 22, 2009, at 03:39, email@hidden wrote:
>
>> I have a very simple object model that contains, along with 4 or 5 others, an abstract entity.
>> The app uses NSPersistentDocument.
>>
>> I have created a new model version that changes a transient property to a modelled property in an entity derived from the above abstract entity.
>> I have created my mapping model and configured the PSC with NSMigratePersistentStoresAutomaticallyOption.
>>
>> Migration always fails with multiple validation errors.
>>
>> Looking at the data mapping model I can see that the abstract class is not represented.
>>
>> Is this to be expected?
>>
>> Is migration of abstract entities troublesome?
>> Some web statements state a that a mapped migration of abstract entities is not supported. Some other evidence that it is.
>> A different model change - adding a simple BOOL attribute - also fails.
>>
>> Will a manual editing of the mapping model to represent the abstract entity help?
>
> It's a while since I had to deal with this, and it was under Leopard, so I might be a bit hazy ...
>
> The automatically generated mapping model for an abstract entity does not do the right thing. In my case, the abstract entity contained parent (to-1) and child (to-many) relationships, and the model was missing the mapping for the child relationship. I was able to fix it by creating the missing mapping manually (using a mapping in a different entity as a guide).
>
> You should be able to do something similar. If you examine the mapping model it should be fairly obvious what's missing from the abstract entity, and it shouldn't be hard to manually add whatever's necessary to create the BOOL attribute. (If it's not obvious, I'd first try adding the attribute to a non-abstract entity and see what turns up in the mapping model, then back out of the change and do the corresponding thing in the abstract entity.)
Thanks for the reply.
In my case the abstract entity is entirely absent in the mapping.
If I modify the model (and thus break it) to make the abstract entity concrete then it appears in the mapping.
I will try recreating the abstract mapping manually.
Looks like a bug report might be appropriate.
>
> HTH
>
>
> _______________________________________________
>
> 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
_______________________________________________
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