How to avoid circular reference in database design -


given project tasks, have know task active. project can have many tasks. task active each project.

usually need show tasks project current task.

how model in database avoiding circular references?

update

other possible operations:

  • add task
  • remove task
  • move next task(making 1 active)

since can have 1 task active task each project, add attribute project table has identifier of active task in it.

so table project has attributes of (project_id, name, active_task_id, etc), , task table has (task_id, name, project_id).

this model allows have 0 or 1 active tasks in project. solutions involve marking particular task flag indicate active not easy enforce integrity on.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -