Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Database 检查博客应用程序的数据库设计_Database_Foreign Keys_Relational Database_Primary Key_Normalization - Fatal编程技术网

Database 检查博客应用程序的数据库设计

Database 检查博客应用程序的数据库设计,database,foreign-keys,relational-database,primary-key,normalization,Database,Foreign Keys,Relational Database,Primary Key,Normalization,我正在创建一个博客应用程序,多个用户可以在其中发布、共享和喜欢博客 我已经创建了数据库的概要,但我不确定这是否正确。我不知道如何去学习外键,尽管我读过它 有人能帮我解决这些问题吗。我脑海中的一些问题是:- - should the articles(blogs) details be stored in both 'Table Articles' and 'Table Share' at the time a user publishes an article. Will this help m

我正在创建一个博客应用程序,多个用户可以在其中发布、共享和喜欢博客

我已经创建了数据库的概要,但我不确定这是否正确。我不知道如何去学习外键,尽管我读过它

有人能帮我解决这些问题吗。我脑海中的一些问题是:-

- should the articles(blogs) details be stored in both 'Table Articles' and 'Table Share' at the time a user publishes an article. Will this help me in writing a php script in showing only the latest and shared articles on top of the page

- should articleid be stored in all tables?
下面是我的数据库的概要

使用者

表用户

文章

文章有标题和描述。后来我计划添加图像,但不是现在。用户可以在注册或登录后发布文章。最新文章与共享文章一起显示在页面顶部

桌上物品

评论

用户应该能够对其他用户的文章发表评论+发布者也应该能够发表评论

表注释

分享

用户应该能够分享他们喜欢的文章。发布文章的人不能再次共享该文章。如果一篇文章已经被分享,它应该和最新的文章一起放在所有文章的前面

餐桌共享

用户应该能够喜欢任何文章

桌状

确保您散列了用户密码并存储了一个salt

选择一个通用的日期命名方案。这次行动很好。例如,在注册或创建。您应该在单词之间使用下划线,以实现最大的兼容性和易读性

您确定用户需要登录才能发表评论吗?许多博客系统只允许人们通过电子邮件地址发表评论。不允许评论线程

您可以将创建的_at字段添加到like表中。确保在项目id和用户id上都有主键

共享是如何工作的?他们和谁分享

否则,一个好的开始

-userid
-email
-name
-password
-date_of_registration
-articleid
-userid
-title
-description
-datetime 
-commentid
-articleid
-userid
-comment
-datetime
-articleid
-userid (the person who shared it)
-datetime
-articleid
-userid (the person who clicked on the like button)