简体   繁体   English

网络聊天应用数据库方案

[英]Web Chat Application Database Scheme

I am making a classified like web application where I want to implement a chat message module. 我正在制作一个分类的Web应用程序,我想在其中实现聊天消息模块。 While searching on Internet I found a database scheme ERD Diagram. 在Internet上搜索时,我发现了一个数据库方案ERD图。

在此处输入图片说明

I am able to understood it but one thing is confusing me is is_from_sender column in message entity . 我能够理解它,但是让我感到困惑的是消息实体中的is_from_sender列。 I found the sample data which is this . 我发现这是样本数据 Since I am a beginner I need a little explanation how this works , why using is_from_sender? 由于我是初学者,因此我需要一些解释,说明为什么要使用is_from_sender?

I think that the purpose of the is_from_sender column, which is a boolean field, is to differentiate each message whether it comes from the sender or from the receiver in order to make some logic on it in the application. 我认为is_from_sender列(它是一个布尔字段)的目的是区分每条消息,无论它是来自发送方还是来自接收方,以便在应用程序中对其进行逻辑处理。 For example: my messages will be shown in grey background and the receiver will be in blue background. 例如:我的消息将显示为灰色背景,而收件人将显示为蓝色背景。 This ERD is modeled in a way that you cannot know who sent it (only who initiated the conversation by the header). 该ERD的建模方式无法得知谁发送了该ERD(只有谁通过标题发起了对话)。 The designer wanted to know this information so instead of adding to message table an int column of the sender user id (foreign key), he just added a bit column which is less expansive is size 设计者想知道此信息,因此他没有在发送者表中添加发送者用户ID的int列(外键),而是添加了一个位列,该列的大小较小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM