Now we need to develop an article classification function. At present, there is a tentative three level classification. Considering the scalability of the classification, the table structure is designed as follows:
The question now is whether we need to save another hierarchical relationship, that is, to save the path, or to keep the depth of the tree.
The article table:
id name type_id Article ID name is classified as ID
id name parent_id Classified ID classification name classification of parent ID
Another way is to pull the type_id out of a table in the article to make a relational table.
Personal comparison recommends second ways to store the relationship separately and facilitate maintenance.