简体   繁体   English

管理员角色的数据库设计

[英]Database design for admin role

I am desiging an app that have users who can write different posts(text, file image etc.). 我正在设计一个具有可以写不同帖子(文本,文件图像等)的用户的应用程序。 In order these posts to be made visible to the other users, there should be an admin who will validate that the content of the post is correct and will give permission for the publishing of the post. 为了使这些帖子对其他用户可见,应该有一位管理员将验证该帖子的内容正确并授予发布该帖子的权限。 I am using relational database. 我正在使用关系数据库。 What is the best way to design the database in order to support this feature? 设计数据库以支持此功能的最佳方法是什么?

  1. You should create posts table having status_flag(value 0 and 1) column. 您应该创建具有status_flag(值0和1)列的帖子表。

  2. If some one posts it, keep status 0 by default. 如果有人发布,默认状态为0。 When Admin approves it, change status to 1. 管理员批准后,将状态更改为1。

So single table will suffice all your need, you don't need to create dependency on tables resulting into better performance. 因此,单个表就可以满足您的所有需求,而无需创建对表的依赖关系就可以提高性能。

Like Mohsen said, having a status_flag column would work. 就像Mohsen所说的,拥有status_flag列将起作用。 I would also add a foreign key in the posts table, that references the Id of the moderator. 我还要在posts表中添加一个外键,该外键引用主持人的ID。 That way, you can track who approved each post. 这样,您可以跟踪谁批准了每个帖子。 Additionally, you may want a third column, a timestamp called date_approved for more tracking purposes. 此外,您可能需要第三列,称为date_approved的时间戳,以进行更多跟踪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM