简体   繁体   中英

PHP-MySQL Email type Messages sender's name storing debate

I'm working on building a database for a messaging system that will work more like an email rather than a Chat.

I've come across a little debate whether I should allow for the sender's name to be static or dynamic.

What I mean is, should I save the current user's display name as is when the message is sent or for the name to be pulled from the user's personal details? This means that if the user changes his/her display name, it would take effect on every message ever received by others.

In my project, I do not forsee users changing their display names frequently but it is bound to happen and I am not sure which approach to take.

The only thing that comes to mind is that if I do it dynamically, it could be confusing for someone to look for the messages of a given user and not find them because the name has changed.

Any pointers?

This will really come down to how you want your application to function. Both points you raised are valid.

If I were implementing this feature I believe I would go the route of having the usernames change dynamically. However I would save all past aliases of each user in a separate table, and have a page/widget that would display them. For example, when a user opens a message from x user they could hover over the name and all past aliases would show in a modal. Or they could click on the name, be directed to the user's profile where you would have a link that they could click on that took them to a page that showed all past user aliases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM