Saving the user's visible log

For the application, I need to save user logs that come in different formats, for example, account changes depending on the particular application. The former goal was to have twitter, like a news feed about their account and global sent messages.

The problem is that I'm not sure how to save this information. For example, let's say a user sends a support ticket. I want a message to appear on their feed: "The ticket" I need help "was sent to the help desk" Where the name will be a link to their ticket. "

Would it be wise to keep the entire link in the message? I personally do not want this, because the name of the ticket may change or the location may be changed. I thought about storing the ticket identifier with the message in its own column, but what about another message that does not use the ticket identifier, but instead a different identifier? Can I create a new column this way?

Let me know if additional information is needed. Thanks for the help!

+4
source share
1 answer

just use a boilerplate approach

+--------------+ + event + +--------------+ + id + + user_id + + type + + custom_id + +--------------+ 
  • id is your key auto-increment
  • user_id: your user key
  • type is a type, for example send_message, created_ticket, regardless of what your application should register
  • custom_id is just a number if type is send_message, possibly a message identifier, if created_ticket ticket identifier, which identifier do you need to identify ressource

you can use custom_id and type to get the name of the link.

+3
source

Source: https://habr.com/ru/post/1335514/


All Articles