Want to Create a Chat application for One to One(individual Chat) and Group Chat (like Chat Room), I need a Help of Creating a Database and Tables for storing the data, I need a refference for the Database Table structure for Chat Application in SQL Server. Any One suggest the table columns for reference
Loading
Aravind GovindarajPosted Feb 15, 2023, 3:19 PM
could you please refer Tuhin Paul approach since it has loosen and extendable approach
Tuhin PaulPosted Feb 14, 2023, 9:18 AM
A database schema for a chat application in SQL Server:
In this schema, the Users table stores information about each user, and the Conversations table stores information about each conversation (e.g. one-to-one chat or group chat). The UserConversations table is a many-to-many relationship between users and conversations, allowing multiple users to participate in the same conversation.
The Messages table stores individual messages sent in one-to-one conversations, while the GroupMessages table stores messages sent in group chats. Both tables have foreign keys to the Conversations table and the Users table, so it's easy to retrieve the conversation and sender information for each message.
Finally, the Groups table stores information about each group, and the GroupMembers table is a many-to-many relationship between groups and users, allowing multiple users to belong to the same group.
Of course, this is just one example of a database schema for a chat application, and your specific requirements may vary.
Amit MohantyPosted Feb 14, 2023, 9:10 AM
Atleast you need four table for a chat application
Users table: This table will store information about the users of the chat application.
Conversations table: This table will store information about the conversations between the users.
Participants table: This table will store the participants in each conversation.
Messages table: This table will store the messages sent in each conversation.
Jignesh KumarPosted Feb 14, 2023, 7:17 AM
Please refer this one which may help you to get more idea,
https://github.com/tinode/chat/blob/master/server/db/mysql/schema.sql
https://dba.stackexchange.com/questions/192172/how-to-create-a-flexible-table-schema-for-storing-messages-from-different-chats