K
K
Konstantin Podyganov2019-05-31 14:32:24
Database design
Konstantin Podyganov, 2019-05-31 14:32:24

How is message data stored in the database?

Are they all stored in a separate table linked to the user?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Valery, 2019-05-31
@Desay

It depends on who writes how.
Of course, it is correct to store separately.

K
Konstantin Eliseev, 2019-05-31
@K0r5hun

Separately. User bound. Usually one user can write several messages.
I store it like this:

id	integer Auto Increment 
chat_id	integer	
user_id	integer	
body	text	
created_at	timestamp(0) NULL	
updated_at	timestamp(0) NULL

I
Ivan Shumov, 2019-05-31
@inoise

Just for the record - OLTP is not the right place to store messages. A more document-oriented database is more suitable here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question