2 months ago

User Activity Log

Posted 2 months ago by mulai


I have two database tables users and activity_log with dummy records as below:

Table users

id name

1 Michael

2 Joseph

Table activity_log

id user_id activity

1 --- 1 ---------- you received $30 from Joseph

2 --- 1 ---------- you withdrew $20

My problem is that, I don't want to hard-code the name Joseph in the activity since the user might change his name in the future. I want when user 2 changes his name from Joseph, user 1 activity log will be updated accordingly with the new name.

As an example, I need activity log similar to that of Facebook where for example Michael can see in his activity log 'you liked Joseph's photo'. If Joseph changes his name to Jose, Michael will see in his activity log 'you liked Jose's photo'. How can I achieve that?

Thank you in advance.

Please sign in or create an account to participate in this conversation.