Relational database design cycle
Asked Answered
L

1

0

I have the following database design:

enter image description here

I want to add a new table named Task, which would have a one-to-many relationship with a Project(Project will have one or more tasks and particular task will belong to only one project). Next users will also be assigned to different tasks in a project(basically User table needs another many to many relationship with a Task, but that creates a loop in the design). Is this a good practice or should I avoid making loops in a design?

Laporte answered 23/9, 2014 at 18:16 Comment(0)
H
0

Next users will also be assigned to different tasks in a project(basically User table needs another many to many relationship with a Task...)

Probably not.

You probably need only those users who are related to a particular project assigned to specific tasks. So you need a foreign key from tasks to reference the project's users, which seems to be the oddly named table "Project_userprojectrelation".

"Loops" are a nuisance sometimes when you need to cascade updates or deletes. But you can usually delete rows from the "end" or the "middle" of the loop toward the "top". The only time that doesn't work is when you have foreign keys chasing each other around the loop in the same direction. Most dbms's will warn you about that kind of problem.

Housing answered 23/9, 2014 at 21:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.