Replies: 2 comments 1 reply
-
|
You can create relation such as in docs loco example then you can make detail changes in migration file. Also you can refer in seaoorm docs another good reference |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
You can achieve this by using a reference. Here's an example to guide you: cargo loco generate model good_users users:references:id [....]This command generates a model named |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Suppose I have a table named
website_userswith a primary key columnid. Now, I want to create another table namedgood_usersthat includes auser_idcolumn referencing theidcolumn ofwebsite_users.I want to use
cargo loco generate modelto generate the model forgood_users. However, I am unsure how to define the foreign key relationship betweengood_users.user_idandwebsite_users.idusing the CLI.Is there a way to specify the relationship directly when generating the model? Or do I need to manually define it in the generated model file? If so, what is the best approach to properly set up the relationship in SeaORM with Loco?
Beta Was this translation helpful? Give feedback.
All reactions