Question

Trying to implement a rating system of users and postings.

What is the best schema for managing the multiple reputations.

A user has a reputation derived from postings and feedback(similar to SO).

Postings have a reputation too (again similar to SO).

My initial idea as to have one reputation table. The rows would correspond to the id of the user/posting and the value of the vote.

Two Questions:

  • Is this the best way of managing this?

  • The unique Ids of the user and posting records are auto incremented, the default value that rake would create. Seems like there is a possibility the unique_ids could collide. Is that valid concern? How could I mitigate this?

Thanks

Was it helpful?

Solution

I would have separate tables for the post reputation and user reputations. These are semantically different things and should be separated as such.

This way you can have one table which has a foreign key to the post, and the other with a foreign key to the user for which the reputation is applicable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top