2011-08-12 19 views
3

我有一個小的消息系統,可以在用戶和管理員之間發送消息。如何設計我的模式,SQL方式和NOSQL方式

我們有不同的管理員,所以他們的回覆需要知道早期的消息。

在一次會話中,它沒有那麼多的消息。

 
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, 
) 

我不知道它是否是一個好的解決方案。

以上,我們的系統也使用nosql數據庫。 所以我覺得我在的NoSQL數據庫中的數據會喜歡這些:

 
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), 
} 

如果我使用的NoSQL數據庫,這是一個好的解決方案嗎?

回答

0

在我看來,如果你打算讓數據與模式不匹配,NOSQL只會對此有意義。上面的代碼看起來像它會更適合SQL,但任何一個都可以工作。

+0

謝謝,我只想找到哪種方式更容易爲開發人員。並以不同的方式來實現它。 –