I'm working on a smallish voting webapp. Similar to strawpoll but only authenticated users are allowed to make polls, while everyone is allowed to vote.
User:
- id
- email/password_hash/name/…some other data…
Poll:
- id
- user_id REFERENCES User.id – notes which user created the poll
- title
PollOptions:
- id
- text
- poll_id REFERENCES Poll.id – notes which poll the options belongs to
- count – Number of votes for this option
Votes:
- id(optional?)
- poll_id REFERENCES Poll.id – notes which poll was voted on
- user_id REFERENCES User.id – notes the user which voted
- ip_address – If the the person who voted isn't registered, ip_address will be filled to prevent him from voting multiple times.
I want the owner of the poll to be able to delete polls and change the poll (add more options, remove options, … ) Is my design good enough? If not, what should I change?
Best Answer
UPDATE:
Since OP stated that keeping who voted for what option to be kept secret, here's another solution: