M
M
Maxim2019-05-26 07:23:08
Database design
Maxim, 2019-05-26 07:23:08

Table architecture. How to do it better?

Hello!
I can't figure out how best to store users on the site.
I have a user and profile table. All registered users are included. The required fields are password and email.
Next, I will have a module of organizations with the storage of information about organizations. Organizations can have several roles: employees: director, leader, coach, choreographer.... Personalities of the organization: dancers, singers, athletes....
Then there is the event module. An event can have:
Organizing committee: organizer, presenter, scorer, volunteer, security guard
Each event has a registration and in it:
Mentors: teacher, choreographer, trainer ... (from the organization module - employees)
Participants: dancer, sportsman, singer... (from the organization - personality module)
I get a complete relationship between the tables. And now I'm thinking how to design the base. After all, the profile is the same for everyone, but the roles can be different.
Except how the story is all on the Tables: user and profile. I thought to make separate tables for each, but this is not reasonable. It will be necessary to do data synchronization and this data will be too much. What will increase the database.
User authorization according to the user table. Basic data from the profile (last name, first name, date of birth ...)
I actually have two questions:
1. Is it right to hang everything on two tables? I think yes. Then the second question.
2. Users can add not all fields, but, for example, only the last name and first name needed for a particular module. But what should I do with the authorization of such users? After all, authorization by email. This is a required field in the user table. The profile will also be linked to the statistics of other modules, ratings, achievements... All this data will be linked to the user and profile. But if email is not filled in one place, then the user has the opportunity to create a new account and keep new statistics. Then he will notice that suddenly he has two accounts and will have to combine them. Or the owner of the created account suddenly showed up. For example, a child has grown up and needs access. With this point of the question, I slowed down. And I don't know how to go further and implement it. Tell! I will be very grateful!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
d-stream, 2019-05-26
@myks92

What will increase the database
you can start to be afraid of this if users exceed millions. Well, or if this is an implementation in a wristwatch, where there are not enough resources)
And so - one of the options:
- accounts (not quite a user)
- counterparties (people-organizations-families)
- contact details (of different types)
- connections (of different types between contractors - husband-wife-employee, etc.)
- access levels (roles, profiles)
- statistics, etc.
this is a somewhat redundant structure, but it will allow you to "process" situations when a person works in several organizations at once, changed a family a couple of times, whose members are still turns out to be the employees of other organizations in the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question