S
S
StynuBlizz2017-05-12 10:22:13
PostgreSQL
StynuBlizz, 2017-05-12 10:22:13

How to save a list of people a user follows in a database?

How should the list of those people to whom the user is subscribed be stored?
Would it be correct to create, for example, in the users table (a table with all users and their data (login password, etc.)) the subscriptions parameter in which for each user to store an array consisting of the id of the users on which he is subscribed?
Here is the view of the table (I made a diagram in haste)
b6fda92c323945cea2d9df73ba8e216e.PNG

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Bukharev, 2017-05-12
@StynuBlizz

Wouldn't it be easier to create a separate table where to write user_id, subscribe_user_id and the subscription date?

L
lega, 2017-05-12
@lega

the subscriptions parameter in which for each user to store an array consisting of the id of the users on which he is subscribed
Yes, it's okay, you can also make an array - who is subscribed to the user, or both, depending on the use.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question