I have the following model: (goal is to create a news feed / activity feed for my app).
Activity:
id.int | user_id.int | item_type.string | item_id.id | created.timestamp | data.string
With the intent that I can create records like:
{id:1, userId:1, item_type:Photo, item_id:33, time:2008-10-15 12:00:00, data:{photoName:A trip to the beach}}
{id:2, userId:1, item_type:Comment, item_id:312, time:2008-10-15 12:00:00, data:{photo_id:3131, photoName:A trip to the beach}}
where:
- id = auto incremement
- userid = user who created the activity
- item_type: model so this works for unlimited models in the app
- item_id: ID for the type above
- time - very important!
- data - misc info that will allow for displaying the activity without extra DB queries or joins... performance reasons...
I need you thoughts around:
- Feedback on the model. Any concerns or improvements?
- Now that we have a model, what is the smart way to CREATE ACTIVITIES for several of the items on the App, like Books (Create, Update, Commented), Photos (Create, Commented)
Thanks