I'm writing this post hoping to start a discussion about a good database model (Relational primarily) to serve most of the use-cases that require storing notifications in the database.
By notification, I mean something like "John commented on your post" or "Doe likes your profile".
I have been using polymorphism for the notification source and notification destination. I would use sometimes a JSON column to store arbitrary data, but I really hate it and would like to improve my methods.
Here are some points to discuss:
- How to store notification source?
- How to handle different notification types?
- Notification messages?
- Status?
- Should a single notification instance be linked to multiple destinations or just duplicate for each destination?
- What is an efficient query to list and paginate notifications when a user has different roles?
Cover image credit: https://www.kindpng.com/
Top comments (0)