How is the data table structure of (codeshelper) 's comment system designed?

the comment system involves the following elements:

users users
questions questions
answers to answers questions
comments answered by comments
responses to replies comments

question_applauses likes questions
answer_applauses likes answers
comment_applauses likes comments
reply_applauses likes comments

answers adopted by adopt_answer

question
1, which data tables are needed?
2. What is the relationship between these data tables?

Mar.06,2021

comments and answers should be tabulated. The
comment table should have these fields:
id add
content comment content
uid who wrote the comment
type type, is the comment of the question, or the id, of the answer
qid/answer_id question or answer, of course, you can also divide the comment of the question and the comment of the answer into different tables, so that you don't want the type field.
time add time
number of likes obtained by zan
pid replied object, if not, it is 0
status status, normal, or deleted, or deleted by the user (deletion method, codeshelper does not necessarily distinguish)

The tables associated with

should be:
user table,
question table associated with uid,
answer table associated with qid,
approval table associated with answer_id (choose one of the two with qid), each approval should be recorded, and all should have a separate table.

if it were me, I would almost design it this way.

Menu