Answer the question
In order to leave comments, you need to log in
How can I make a consistent structure in the database (ER-model)?
The bottom line is that all tables should be connected sequentially, there should not be circular connections, as it is now in the diagram.
There are tables Users, Projects, Tasks, Messages.
The user can create a project, tasks in the project. When you create a project, a chat belonging to this project is created. All users in the project can write to this chat.
Users can create tasks in a project that have fields:
- project_id (id of the project to which the task belongs)
- creator_id (id of the creator of the task)
- performer_id (id of the performer)
The point is that the user is associated with the project once, and now he is connected three times: via chat, via task and directly
Answer the question
In order to leave comments, you need to log in
In Task
should be references not to User
, but to Project_User (id)
. After all, only those who work with the project can create and perform tasks.
a chat belonging to this project is createdWhy are you the opposite? Several projects are linked to one chat.
Chat
, and in Message
should refer to Project
and Project_User (id)
. Project_User
there should be a link to a separate table Role (ID, Name)
. Don't break third normal form. Chat
: ID
Name
. "Game" for example. Project
Project, "Game, balls", for example. If NULL - common. Role
Role - group by role, "Game, balls, tester", for example. If NULL - common for the project. If the project is also NULL, it is generic by role. "Game, tester", for example.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question