0

I am designing chat within my mobile application. I am using firebase to power the chat.

The chat system has multiple isolated teams and data is de-normalized to ensure that we get only the required data without any deep nesting.

The high level current schema I have is as below :

enter image description here

The issue I see in this schema is how to handle the update scenarios. The main update scenarios I am seeing are :

  • User updates the display name (user_alias)
  • Group names are changed

If user changes the name, then all the messages needs to be updated. Also all the direct message channels needs to show the updated user profile name

Similarly if group names are updated, we will need to update all the user_channels

What would be a better design to handle the update scenarios?

One option I can think of is using an address book so that I can look-up based on the user-ids. Any suggestions will be helpful.

KENdi
  • 7,576
  • 2
  • 16
  • 31
Sharath Chandra
  • 654
  • 8
  • 26
  • @FrankvanPuffelen thanks for pointing to the answer. It outlines all the different approaches. Personally for this app, I will go with transaction update using cloud functions for some scenarios and not caring in few cases. – Sharath Chandra Mar 17 '18 at 06:39
  • Good to hear. The "not caring" approach is surprisingly popular. :-) – Frank van Puffelen Mar 17 '18 at 14:43

0 Answers0