开发者

How to design my schemas, SQL way and NOSQL way

I have a small message system that send message between user and administrators.

We have different admins, 开发者_Go百科so their response making need to know the early message.

In one conversation it has not so many messages.

conversation{
 id,
 kind, ( the type of conversation, like publish request, edit request, other request)
 user_id,
}

message(
 id,
 flag,(read and unread or some)
 conversation_id,
 create_time,
)

I didn't know if it is a good solution.

and more, our system use nosql database as well. so I think my data in the nosql database will like these:

conversation(
 id,
 kind, ( the type of conversation, like publish request, edit request, other request)
 user_id,
 message_list[m1, m2, m3, m4.........],
)

message_list is a dict:

message_list{
 text:text,
 time:time,
 type:(user or system admin),
}

if I use nosql database, is it a good solution?


In my opinion, NOSQL would only make sense for this if you plan on having data that just doesn't match a schema that well. The above code looks like it'll fit SQL better to me, but either one would work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜