Dumb Database schema / EOModeler questions...
"Numair Faraz" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I'm working on a "social news" application written in WO, and am currently in the process of modeling my database (we're going to use FrontBase). As I am not an expert at database modeling / creating scalable solutions - embarrassingly bad, to tell you the truth - I wanted to get some perspectives from the people on the list regarding what they'd do. My proposed implementations seem awfully simplistic, which leads me to believe that they won't scale ... Basically, we have three tables: USER, FRIEND, STORY; what I want to figure out is... - What is the most efficient way to set up the FRIEND table? Assuming that when a user first asks to be a friend of another user, the connection remains pending until the other user confirms (thus meaning all USER.friends relationships are bi-directional), should I have things set up so that FRIEND is as such: FRIEND ====== friendId - LONGINT, Primary Key userId - LONGINT, Foreign Key user2Id - LONGINT, Foreign Key approved - BOOLEAN owner - relationship to USER: FRIEND.userId + USER.userId friend - relationship to USER: FRIEND.user2Id + USER.userId .. with an approval by the other user meaning that another FRIEND entry for their relationship? I am assuming that two transactions / table entries are very inefficient, and that this will cause problems for me later on, but that's the best solution I could think of. Now, assuming that we have USERs and USER.friends .. Say we have the following STORY table: STORY ====== storyId - LONGINT, Primary Key userId - LONGINT, Foreign Key body - CLOB approvedByEditor - BOOLEAN author - relationship to USER: STORY.userId + USER.userId .. How would one fetch all of the stories posted by the friends of a user in the most efficient manner? My avoidance of reading a proper database modeling book has caused me to be incapable of even beginning to figure this out, let alone figure out how I would model it in EOModeler (blame the US education system...). I also need to figure out how to fetch an array that contains both a user's friend's stories, and stories that are marked approvedByEditor, with no duplication; again, no clue how I would do this in EOModeler (which I hadn't used in about 4 years, until this week)... Hope you guys can help ... Numair