database 消息传递应用程序的数据库架构
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7569932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Database schema of messaging application
提问by Sourabh
In my messaging application, The features I want to provide are:
在我的消息传递应用程序中,我想提供的功能是:
- Sending a message to multiple people
- Receiving message sent to a user
- Showing message in groups divided by the users, Like in facebook message
- But when a user will send a message to multiple people, It will not be a group message but those messages will go in groups divided by users
- 向多人发送消息
- 接收发送给用户的消息
- 在按用户划分的组中显示消息,就像在 Facebook 消息中一样
- 但是当一个用户将一条消息发送给多人时,它不会是一个群消息,而是这些消息将按用户划分成组
My database schema is like this

我的数据库架构是这样的

This schema is able to provide all the functions above but getting the message out from this kind of schema in groups of users is very complex. Can anyone suggest me some better schema??
这种模式能够提供上述所有功能,但是从用户组中的这种模式中获取消息非常复杂。谁能建议我一些更好的架构?
The unnamed table is of receivers mapping, forgot to write the name in jpg. :(
未命名表是接收者映射,忘记在jpg中写下名称。:(
采纳答案by johnny
What is wrong with one table?
一张桌子有什么问题?
message_id timestamp to from subject body attachment_pointer origin
message_id 时间戳到从主题正文附件指针来源
...
...
I'll probably get thrashed for it but... hmm...good point
我可能会为此挨揍,但是……嗯……好点
Messages
message_id
timestamp
subject
body
attachment
MessageReference
mr_id
message_id
to
from
edit: Also found these:
编辑:还发现了这些:
Messaging system database schema
thread messaging system database schema design
How should I setup my database schema for a messaging system complete with attachments?

