2 ms·
I've run across this problem before and ultimately decided on the two-record solution. I reasoned that it's entirely possible to have a non-mutual friendship. T
by allknowingfrog 5y ago
I've run across this problem before and ultimately decided on the two-record solution. I reasoned that it's entirely possible to have a non-mutual friendship. The table ends up having a "user_id" and a "friend_id", with each record indicating that one user considers another to be a friend. A "friend request" can even be modeled as a single record, in which case, accepting the request creates the matching entry. The concept of "mutual" friends determines whether two users are connected and visible to one another.