On Aug 23, 2010, at 11:06 AM, Amy Heavey wrote:

> Hi,
> 
> I've got a core data app that I'm working on, and I started off with quite 
> simple relationships. I've got a products entity, and a purchase order 
> entity, which had many to m any relationships between them. I now need to be 
> able to set a quantity for each product in each purchase order. I think I 
> need to set up an inbetween entity, (called purchaseOrderItem) which stores 
> the quantity for each product, and has relationships to the product and 
> purchase order entity.
> 
> I can set it all  up in the datamodel, but to be able to use the data already 
> in the app I need to migrate it over. I expect to initially set all quantites 
> to 1, but I can't work out how to set up the mapping model so it moves the 
> relationships correctly.
> 
> Can anyone point me in the right direction?
> 
> data model 1.0
> Entities:                     Product, PurchaseOrder
> Relationships:        Product <<---->>PurchaseOrder
> 
> data model 1.1
> Entities:                     Product, PurchaseOrder, PurchaseOrderItem
> Relationships:        Product <---->> PurchaseOrderItem
>                               PurchaseOrderItem <<----> PurchaseOrder

I wouldn't change the existing relationship(s)--create new ones instead. You 
will have to subclass NSEntityMigrationPolicy to create appropriate 
"PurchaseOrderItem" relationships from the "Product" relationships.

Have you read this doc:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmMigrationProcess.html#//apple_ref/doc/uid/TP40005508-SW4
 ?

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to