Database design - Approach for storing points for users

前端 未结 4 1614
天命终不由人
天命终不由人 2021-01-03 09:40

Just looking for some suggestions on how to approach the database design for this.

On my site a user can get points for performing different activities. Currently th

4条回答
  •  借酒劲吻你
    2021-01-03 09:56

    A typical design for this would be to have the User table, the Action table, and the User_Action table for recording all actions the user fulfills. You'd need the two foreign keys and probably a primary key in there, along with a date stamp for when they accomplished it. Then you could store the points for each action in the Action table, and whenever you do a lookup for total points, just join the the tables and order by the timestamp so you can get a history of their points.

提交回复
热议问题