I'm implementing a design for an activity feed using the suggestion from the question: How to implement the activity stream in a social network
If I had a schema like this, how could I best query for the activity feed where activities may have corresponding tags (meaning I need to join some other tables to get tag data).
Example:
Activity 1: user4 tagged publication with tag1, tag2, tag3
Activity 2: publication rated 3 by user2
Activity 3: publication subscribed to by user9`
Activity table:
id
user_id (int)
activity_type (tinyint)
source_id (int)
parent_id (int)
parent_type (tinyint)
time (datetime but a smaller type like int would be better)
My ideas on how to implement this are:
1. Do 1 query with a LEFT JOIN then assign tags to corresponding activities with javascript.
Or
2. Store tags as JSON in a database field