I’m creating a db schema that involves users that can be friends, and I was wondering what is the best way to model the ability for these users to have friendships. Should it be its own table that simply has two columns that each represents a user? Thanks!
Share
When user 1 sends a friendship request to user 2, do
If user 2 denies the request,
if user 2 accepts it:
Then, a friendship can be found this way:
You can make a view with this last query, it will help you query-ing for users’ friends, or even friends of friends.