Which is the better schema?

Soldato
Joined
17 Oct 2002
Posts
3,101
I'm working on some code for a project but I can't decide which is 'better'.

It's for a system where a user adds some data to the database (in this case it's video games) but the data has to be approved by a percentage of the users before it goes into circulation on the website. currently I have:

games
id
game_name
...
approval_rating

users_games_approvals
user_id
game_id

When a user approves a game it simply does approval_rating++ until it reaches the approval threshold and it'll stop appearing on the "games awaiting approval" page. If the click disapprove then it does approval_rating-- until it drops below the deletion threshold and gets removed.

Would it better to do it this way OR would it be better to have a 'games_awaiting_approval' table that is completely separate to the normal games table?

I guess there isn't really a definitive answer but if anyone has any suggestions or comments then they are most welcome.
 
Personally I would do it in the same table like you have already done; it saves a bit of memory and would make for much simpler queries later on.

With the other method you'd also have to write code for moving records between tables and so forth; not an overly complex task but why throw another spanner into the works when you really don't need to?

Keep it simple, IMO.
 
Back
Top Bottom