Looking for a good database structure to achieve Facebook/SO like notifications

Posted by user156814 on Stack Overflow See other posts from Stack Overflow or by user156814
Published on 2010-03-28T23:58:01Z Indexed on 2010/03/29 0:03 UTC
Read the original article Hit count: 415

Filed under:
|
|

I want to be able to have notifications on my site, similar to the way SO does it. I have looked for a good table structure to do this, but I cant seem to figure it out.

I was thinking something like this.

Notifications

id, notification_type_id, user_id, type_id

Notification Types

id, notification_text

Where the notification type would relate to either a new post, a new comment, or whatever features I add later down the line... User Id would relate to whoever the notification is for. Type_id and notification type would go hand in hand, so if the notification_type was a new comment, the type_id would be the comment_id to go to.

This seems good to me, but i want to be able to notify ALL users when something changes.. like on facebook when you comment on something, you get a notification that someone else has also commented on the same thing after you.

I cant seem to figure this out... Help wanted

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql