Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion: help with foreign key #405
Comments
This comment has been minimized.
|
|
sgrif
closed this
Aug 15, 2016
This comment has been minimized.
vitiral
commented
Aug 15, 2016
•
|
Thanks a ton! Would be great if this could be incorporated into the documentation -- the fact that this is handled automagically makes diesel even more appealing :) I imagine if I wanted to pointed to a |
This comment has been minimized.
Not sure what you mean? We're literally not handling anything here. And yes your question about the process is correct. |
This comment has been minimized.
vitiral
commented
Aug 17, 2016
|
the fact that you are adding a row to both the |
vitiral commentedAug 15, 2016
I am fairly new to SQL and rust, and am trying to make a simple test-tracking tool with a db backend (written in diesel and rust).
For an ultra simple version, my tables look like:
I can't find any documentation on how to deal with foreign keys in diesel. Can I just make a struct like:
and diesel will handle creating a new row in
test_nameswhen the name doesn't exist? What is the best way to handle this?