Please follow below Step if you are tring migrate date from one org to onother 1) Create one one external ID on both object and store the old ID(or any unique key) 2) Then upsert the data of parent object but external ID 3) Then upsert the child object data by external id but also map the parent record by parant external ID
1) Create one one external ID on both object and store the old ID(or any unique key)
2) Then upsert the data of parent object but external ID
3) Then upsert the child object data by external id but also map the parent record by parant external ID
I hope that will help you