複数のユーザーがブログを公開、共有、いいね! できるブログ アプリケーションを作成しています。
データベースの概要を作成しましたが、正しい方法かどうかわかりません。外部キーについて読んでも、どうすればよいのかわかりません。
誰かがこれらの問題を解決するのを手伝ってくれますか? 私の心にあるいくつかの質問は次のとおりです:-
- 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?
以下は私のデータベースの概要です
ユーザー
テーブル ユーザー
-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)