Conversation system [closed]
Am trying to build a conversation system for users on a web app am working on. At the the moment am quite confused on how to setup the database tables. for now i have a table with fields this
C_id
Message
- S_id
- R_id
- read
- date_time
Assuming your table is a conversation table (C_id), I would have three tables in all:
- Conversation
- Message
- User
You look to have the third, but have collapsed the other two together. The relevant fields would be:
User
U_id (PK)
Conversation
C_id (PK)
R_id (FK on U_id)
S_id (FK on U_id)
fields relating to the conversation only - eg the date-time it started.
Message
M_id (PK)
Text
Date_time
Has_been_read
Author_id (FK on U_id)
Conversation_id (FK on C_id)
精彩评论