A
A
Analka2020-02-19 22:54:11
Database design
Analka, 2020-02-19 22:54:11

Which table structure to choose for the comment system?

There was such a dilemma: how to design tables for a comment system, such as here on the toaster, so that you can insert both text and links (for example, so that videos from YouTube are loaded), ordinary links and pictures? - is it somehow all in one table to shove or spread across several? To withstand a huge load.

So far I've come to this:

id
thread_id - id записи
user_id
ip
replay - тело
type - тип коммента (1-текст,2-ссылка,3-картинка)
created_at

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2020-02-20
@2ord

There is no functional description of the task, so there is little help on the case.
It will take more than a year for a scalable commenting system.
user_id - who wrote,
and if he answered, who needs to know...?
content - body, which can consist of parts: text and other elements.
You need to know the status of the message: approved, pending moderation, rejected, deleted.
There are many more details that cannot be described.
If the commenting system is not primary for business, then it makes sense to integrate a third-party system, of which there are enough on the market.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question