Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database design for a list of task with subtask

I want to create a database that keeps track of a list of tasks that the users need to do and in the list of tasks there will be subtasks and sub-subtasks and so on. So my question is how to design this kind of database?

Example: A picture of the tasks and subtasks

a picture of the tasks and subtasks

For this kind of database, should I create only 4 tables for the main task, sub task, sub-subtask and sub-sub-sub task or is there a better way of doing it? What if the users want more subtasks? Should I create a fifth table or should I just restrict the number of subtasks available. I feel like having this many tables in a database just for the subtasks is a bad database design

like image 624
user3401369 Avatar asked Apr 06 '16 13:04

user3401369


People also ask

How do I organize tasks into sub-tasks?

Turn an existing task into a sub-taskHover over a task. Click and hold the gray handle that appears to the left of the task. Drag it from left to right to adjust its sub-task level.

Can tasks have subtasks?

But sometimes, a task has multiple components, or multiple contributors. You can't add another assignee to the same task—but you can create subtasks. Subtasks can be a powerful way to distribute work and split tasks into individual components—while staying connected to the overarching context of the parent task.

How do you add subtasks to your tasks select all that apply?

Right-click a task and select Add a subtask. Under the main task, add a new task and press Ctrl + ] (Windows) or Command + ] (Mac). Next to the main task, click Edit. and in the Add subtasks field, enter a task.

What is the difference between tasks and subtasks in Jira?

A task represents work that needs to be done. A subtask is a piece of work that is required to complete a task. Subtasks issues can be used to break down any of your standard issues in Jira (bugs, stories or tasks).


1 Answers

So you have basically a tree of tasks. It should be possible to add a foreign key column to the task entity that references it's parent task. The nesting can be as deep as you desire and there is no need for subtask tables.

like image 125
eschmidt Avatar answered Sep 22 '22 15:09

eschmidt