Replies: 1 comment
-
OK. I've got it (though I'm not sure if that is the best way):
Next thing, removing author_id from Post table, which will probably break the building step if I remove AuthorId from Post struct 🤔
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Simple use case:
I had two tables
Authors { id, name }
Post { id, text, author_id }
Now, I want to allow more than one author for the posts (many-to-many relation).
I created one migration which creates new table:
PostAuthor { author_id, post_id }
in the next migration I want to migrate data to new table:
to take all posts from the Posts table and move Post(id) and Post(author_id) to the new table as PostAuthor(post_id, author_id).
and, after the migration is over, to (eventually in the new migration?) remove the author_id column from Post table,
What would be the cleanest way to do that (dirty way is also acceptable if there is no clean :) )?
Beta Was this translation helpful? Give feedback.
All reactions