Mysql文件夹和文档
我想有文件夹和文件,每个人都有一个文件夹。文件夹可以有无限多个子文件夹。你认为最好的mysql模式是什么?你认为这样好吗Mysql文件夹和文档,mysql,tree,Mysql,Tree,我想有文件夹和文件,每个人都有一个文件夹。文件夹可以有无限多个子文件夹。你认为最好的mysql模式是什么?你认为这样好吗 Table Folders id name parent (if null the root) auth_user (access control type) created_date created_by Table documents id name type idFolder (FK id of folders)
Table Folders
id
name
parent (if null the root)
auth_user (access control type)
created_date
created_by
Table documents
id
name
type
idFolder (FK id of folders)
auth_user (access control type)
created_date
created_by
你认为以上是好的还是以后会有问题?你认为用上面的方法可以快速简单地得到文件夹树吗(我认为用上级ASC的命令可以得到正确的文件夹树) 邻接列表对于插入和移动子树很好,但如果需要查询深度超过一级,则在a**中会很痛苦,因为如果深入到n级,则最终会得到n个连接。示例:显示文件夹X的所有后代/祖先 我建议将邻接列表(parent_id)与以下模型之一结合使用:
is\u folder
列标记它们。我喜欢将文件夹/文件视为树中的“节点”,因此它们基本相同。进一步的元数据将存储在另一个表中