+ 1

DATABASE SCHEMA FOR A CHAT APPLICATION

Good day sololearners, i am a Emmanuel, full stack developer and a game developer, i am looking forward to building a chat app and i was thinking of a database schema in which each users would have a separate table to store their encrypted chat with other users with MYSQLI what do you think about it? if you have any suggestions please drop thanks :)

25th Aug 2022, 4:53 AM
Adedoyin Emmanuel
Adedoyin Emmanuel - avatar
10 Réponses
+ 3
Hi :) I am also learning SQL. My approach is: creating two tables, one will store info about user and second will have messages and timings. (timing is used to sort the messages) We can use 'Foreign key' to link them together this approach could work but I think it's not a good one because the message table will grow rapidly what do you think? Tibor Santa I need your help in this! Is above a good way to store messages?
25th Aug 2022, 10:32 AM
Sandeep
Sandeep - avatar
+ 3
Sandeep the relational databases are designed to handle large amounts of data. Depending on the particular application and the particular database solution, it can take a while before you reach any limit of scalability. But you may also apply strategies to remove or archive old data, to free up space: delete old messages that are no longer interesting. The data model you described, makes perfect sense and it's a commonly used pattern in RDBMS design.
25th Aug 2022, 10:54 AM
Tibor Santa
Tibor Santa - avatar
+ 2
'each user would have a separate table to store their encrypted chat' Can you tell me more about it ? (your approach for storing data)
25th Aug 2022, 9:13 AM
Sandeep
Sandeep - avatar
+ 2
Tibor Santa thanks for confirming! :] Also, is this the same approach Sololearn uses for storing messages? (unlike whatsApp which store data on users devices)
25th Aug 2022, 11:06 AM
Sandeep
Sandeep - avatar
+ 2
There are various types of databases. You can model a forum with relational database but also with an object store, which is the other major flavor (NOSQL) and an example is MongoDB. We have no way to tell, what Sololearn is using in the backend. But surely they store the data on a remote server "in the cloud", not only on user devices. Because you can also see the codes and forum comments on the web UI.
25th Aug 2022, 11:26 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Tibor Santa 'object store' and MongoDB is a new term to me. I searched on internet, it is another way to store data (looks like json). I need to learn this, look like another topic is added to the list 😅 but I will stick to the SQL for now, and thanks again for the help! Your explanations are very lucid :}
25th Aug 2022, 11:41 AM
Sandeep
Sandeep - avatar
+ 2
Sandeep one great spot to start learning about different databases: https://youtu.be/W2Z7fbCLSTw
25th Aug 2022, 2:52 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Tibor Santa You are the best 🙌
25th Aug 2022, 2:56 PM
Sandeep
Sandeep - avatar
+ 1
Sandeep exactly the approach i used in building a prototype. I was just trying to explore.
25th Aug 2022, 11:31 AM
Adedoyin Emmanuel
Adedoyin Emmanuel - avatar
0
Suggetions related things should be in Feed Posts https://www.sololearn.com/discuss/3021159/?ref=app
25th Aug 2022, 7:29 AM
A͢J
A͢J - avatar