投票に最適なデータベース スキーマは何ですか? 一対多の関係はこれに適していますか? 私は2つのテーブルを持つことを考えています:
poll_questions
int id
varchar body
datetime created_at
datetime updated_at
poll_answers
int id
varchar body
int votes default 0
int question_id (foreign key to poll_questions.id)
datetime created_at
datetime updated_at
次に、回答に投票したユーザーを追跡するための 3 番目のテーブルもあり、ユーザーは 1 回だけ投票できます。
poll_voting_history
int id
int question_id (foreign key to poll_questions.id)
int answer_id (foreign key to poll_answers.id)
int user_id (foreign key to the id in the users table)
datetime created_at
datetime updated_at
あなたの考えは何ですか?私はそれについて正しく考えていますか?