For example, I have two tables:
Question(QuestionID, QuestionTitle, QuestionContent) and
Answer(AnswerID, QuestionID, AnswerContent).
Now, I have a
Vote table that support vote for both
Answer. I have three ways for designing database:
1. Vote(VoteID, QuestionID, AnswerID) // always QuestionID or AnswerID is null 2. Vote(VoteID, PostID, type) // type = 0. PostID is Question. type = 1. PostID is Answer 3. VoteAnswer(VoteID, AnswerID) VoteQuestion(VoteID, QuestionID)
I don't know which database design I should follow in those cases, using ORM and just using native query.