I am obviously not looking to build a second facebook or myspace or <insert new web 2.0 social network name here> but my idea is very simple for my mokocharlie.com market platform. We want to have traders who can network with each other. Share ideas, messages and even advertisement credits. This idea obviously would require the use some sort of database infrastructure that can describe connections between two users at the most basic level.

The easiest way to do this would be to have as your first level, a user table, with all the user data for your purposes. Then the next thing would be to create another table for confirmed connections.

Then another table for pending connections. This will obviously hold your friend requests and so on and after they are confirmed, they are moved to the confirmed connections table. From where you can do all sorts of things.I am obviously not going to go into the internals of my market platform but the structure for the database could be as follows:

usertable
userid
firstname
lastname
email
password
... user
verified

confirmedconnections
connection
id
userid
friend
id

pendingconnections
connection
id
userid
friend
id

the details are really up to you as many roads lead to Rome, but one must of course make sure that the information is consistent. So that your application logic makes sure that the connections from pending... are moved to confirmed and not just copied or a user would have quite a few duplicate friends.

That's my take on this, I am open to any other suggestions on making this better.

Tags: