Saving a visible user log
For an application, I need to save user logs that come in different formats, like account changes among application specific changes. The over goal is to have a twitter like news feed about their account and global sent messages.
The problem is I'm not sure how to save this information. For an example, say the user has submitted a support ticket. I would want a message on their feed to display: "Ticket "I need help" has been submitted to the Help Desk" Where the title would be a link to the their ticket.
Would it be wise to save the entire link in the message? I personally don't want to, because the title of the ticket could change or the location could be changed as well. I have thought about saving the ticket id along with the message in its own column, but then what about other message that don't use ticket id and instead another id? Would I create a new column that way?
Let me know if more informati开发者_JS百科on is needed. Thanks for all the help!
just do a templating approach
+--------------+
+ event +
+--------------+
+ id +
+ user_id +
+ type +
+ custom_id +
+--------------+
- id is your key autoincrement
- user_id: your user key
- type is a type for example send_message, created_ticket whatever your application need to log
- custom_id is just a number if type is send_message maybe the message id, if created_ticket the ticket id, what ever id you need to identify the ressource
you can use the custom_id and type to fetch the link title.
精彩评论