So to begin with this question is not related to Push Notifications. What I want to achieve is a View in which all notifications are displayed. Something like Instagram or Facebook.
There could be a number of resources from which these notifications could come. Lets say:
- Somebody likes my photo. (Came from
likestable.) - Somebody commented on my photo. (Came from
commentstable.) - New Promotion. (Came from
promotionstable.) - New Security alert. (Came from
alertstable.)
What is important is that I need to display only one row per item. So if 10 people like the photo I want to update that single row in real time. Also another important thing is Pagination. This is the point where I'm having difficulties. It's very hard to implement pagination when these resources come from different tables.
So my question is: Should I create another notifications table and whenever one action is performed, I insert a new row to this table and then perform a paginated query here, or should I fetch and then merge these notifications from different tables?