Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
private messages/friends database structure
Old 02-15-2007, 07:24 PM private messages/friends database structure
Novice Talker

Posts: 10
Trades: 0
ive been looking around for a database stucture that would work well for private messages. here is one that i am thinking about that i wrote myself.

id serial,
from bigint unsigned not null, from user id
from_ip int unsigned not null, from user ip
to bigint unsigned not null, to user id
datesent stamp default current_timestamp, sent timestamp
dateread stamp, read timestamp
deletefrom boolean, whether from user deleted it from sent
deleteto boolean, whether to user deleted it from inbox
subject varchar(255),
text text


inbox would be all messages where user=to column and deleteto=0
sent would be all messages where user=from column and deletefrom=0
then if both deletefrom and delete to == 1 i delete the message

it seems to me that it might work alright, anyone have any suggestions or possibly a better pm system?

also, i have been looking around for a friends type db structure similar to like myspace anyone have any ideas about one.
devinb83 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-15-2007, 09:52 PM Re: private messages/friends database structure
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
It sounds like what you're describing would work. I would personally move the subject and body into another table ( that also has the corresponding ID ) so that you can do queries faster that don't need these pieces of information. But that's, well, I'm being nitpicky.

You most absolutely want to not name any fields "from." As in "Select From From table." That would be bad. You use double-quote marks to make this okay ( Select "From" From Table ) but that gets confusing, and if you're using dynamically generated SQL, it will kill you.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to private messages/friends database structure
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11363 seconds with 12 queries