Database structure for contacts in a CRM?

Let's say one is building a CRM and working on the database. Initially I thought each contact would be an entry in the contacts schema and every user who has that contact's email will have access to that entry. So anyone who adds [email protected] the db will query for that email and pull that data up. But then I need the ability to change that contact's data for that specific user. Say if they wanted to change their name or address or add a tag for that user. It doesn't make sense to update it for everyone, only this user, so then I'm thinking... okay maybe there are alt fields where different users can have custom key value pairs. So this contact schema will have a key and an array for custom values with the key being the userId. So something like... {name: [{user321: "bob"}, {user435: "bobby"}], } This is already sounding incorrect... That lookup seems like it'll take forever to pull all client fields for all clients of a user. So then I'm thinking, so each user needs to have a unique set of contacts and if I have 1000 customers and they each have [email protected] then there will be 1000 entries of [email protected] somewhere in my database? Can someone help me understand what the appropriate database structure/ schema is for something like this?
2 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Paul
PaulOP2y ago
This is very helpful. Thanks a lot!
Want results from more Discord servers?
Add your server