Facebook friends data model - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Facebook friends data model (/showthread.php?tid=12388) |
Facebook friends data model - El Forum - 10-17-2008 [eluser]Daniel H[/eluser] Hi all, Any guesses as to the data structure of 'friends'? As a guess I'm working on the following basis: Code: CREATE TABLE `friend_request` So, a friend request is created; this is accepted or denied. If accepted, a 'friend' record is created with the link being made between user a and b. However, to make things more logical, I'm expecting to write two records to show 'both sides' of the friend relationship, such that a query for user_id_a will yield all their friends without performing another query for user_id_b. On removal of a friend, the two records are then deleted. Surely there is a more sensible solution to this, a la Facebook? Any ideas? |