Xiao Bai asked for help, the same table, a field a is associated with a field b, can deleting a incidentally delete the field corresponding to b? Details, inside.

  mysql, question

The foundation is not very good. .
I used django and my own ORM. . .
Now there is a function, the comment function.

Comment table Comment inside has comment content and primary key ID.

Now I want to add a comment with a comment function.

The current plan is:

1. Add an attached comment table temporarily named comment1, then add the comment content, and then set it as a foreign key to associate the original Comment table.
 2. I want to add a comment_id field to the original table to associate comment_id with the primary key id in the comment table.

Now the problem is mainly plan2. . . . If a field is added to the comment table, how should this field be set?
1. set as ForeignKey? Can the fields of your own table be used as foreign keys of your own table?
2. Set to OneToOne? It’s not very good to try. A comment_id can only be associated with a table id, so there is no way to have more than one comment under one comment. . .
3. Set to ManyToMany? I don’t quite understand how to play this. .

It’s a small white problem. I hope you can answer it.

Suppose it is a microblog system.
Question 1: Yes, but this is not called a foreign key, just like a navigation bar. id is the father of comment_id.

Finally, your business logic is just two levels of comments (general reply to comments, reply to comments)

As for onetoone manytomany, it’s not that complicated. that’s the relation between microblog table and comment change.