Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update foreign IDs #54

Open
deanzod opened this issue Oct 12, 2022 · 0 comments
Open

update foreign IDs #54

deanzod opened this issue Oct 12, 2022 · 0 comments

Comments

@deanzod
Copy link

deanzod commented Oct 12, 2022

Is there a way to clone a model with a relation, but on the related model also update another ID column to match the equivalent cloned model's ID?

e.g.
Say you have Section containing many Posts and Comments. A post has many comments. But a comment also belongsTo a different post in that section:

Table: comments
id | post_id | related_post_id

Clone a section & Posts, with comments (straight forward)

But then if I make the relatedPost relationship cloneable, yes it updates the related_post_id in the new comment row, but it also creates a new clone of that post too. How can I get it to just change the foreign_id without creating double posts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant