我尝试设计社交网络(一种)应用程序。 我有一个用户,他有关注者,并且有一个时间表。 我的时间表表如下:
user_id
second_party_user_id
created
other_fields
因此,当“ second_party_user”发布任何新内容时,我会吸引所有关注他的人,并将其插入他们的时间轴second_party_user的帖子中。 当用户看到时间线时,我通过user_id向其时间线进行了简单的请求。 问题是我需要订购商品。如果要按创建顺序排序,则需要将其作为第二个群集列,而不是第三列。 同时,如果我将其作为第二个群集列,即:
user_id
created
second_party_user_id
other_fields
然后,当一个用户取消关注second_party_user时,我将遇到问题,即如何删除(user_id,second_party_user_id)。
任何帮助将不胜感激! 预先谢谢你。
答案 0 :(得分:2)
要处理这些功能,可以使用两个表,一个用于安排时间轴,另一个用于处理两个表中的消除。
//order timeline by created date
user_id(pk)
created(ck)
second_party_user_id
other_fields
//with this table you can get created to delete in the first one and
//delete this table with (user_id,second_party_user_id)
user_id(ck)
second_party_user_id (ck)
created
other_fields