How to structure database for unread item alerts per user

前端 未结 3 887
闹比i
闹比i 2021-02-06 05:33

I just have a general database theory question. I have a need to make something similar to showing what posts/items a user has viewed or not (such as in a forum) or an unread em

3条回答
  •  情深已故
    2021-02-06 05:43

    Based on this description I would use a simple table with maybe 3 columns.

    1. User ID
    2. Post ID
    3. Timestamp First Viewed

    When a user views a post, add a row to the table. If a row does not exist in the table for a given user/post id combo, then they have not viewed the post.

提交回复
热议问题