Database for messaging system with comments and responses

Asked

Viewed 517 times

3

This is my first question. and I don’t know if I’m doing it right. So I apologize in advance if I’m wrong. the doubt I have at the moment does not concern code. but on how to organize the database in a messaging system.

To give an example I want the messages to work like the posts of FB the user creates the public message and other users can interact with this message. The question is, I should create a messages table and arrange for example with a Status column that will define whether the text is a post or response.

OR I should create a table and name pr example of [ID]_respostas where ID would be the id of the main message. It’s a simple question. but I’d like to know the best way to work this case.

  • Welcome to the stack. First of all, the entire database structure relies heavily on the features you want to implement. In a very light way, Oce can have user table, posts, comments. Only with these 3 Oce already cosnegue create some interactivity. But Voce wants to create a chat or a feed?

  • Thanks! is not a chat would not be like a msm feed. Thanks for the help.

1 answer

1

I suggest you create a table to store the posts and another table to store the answers, containing a foreign key relating to the table of posts. You can also include another key relating to the response table itself if you want to relate a new answer to an existing answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.