Tasks and SubTasks, 2 tables or not 2 tables, that is....

Dmak

Registered User.
Local time
Today, 07:29
Joined
May 10, 2012
Messages
65
I've almost completed a little task manager add-on for my main database.

It's nice and simple but I want to add subtasks so a user can break a main task down into logical steps.

The question is, should I create a new table for the subtasks or should I use the existing tasks table and create a field referring to the parent task ID?
 
Both options are valid. If you do a self-referencing table, then you can nest deeper than one level, but you're not proposing that.
If you're just going to go one level deep, there's not a lot of differences between the two approaches, really. Two tables might be slightly simpler in that case, since everything is a little more explicit, like you won't need to run a check to see if a record is a parent or child.

Six of one, half-dozen of the other.
 
Thanks for your thought and feedback, much appreciated. I'm still to decide. I'm sorely tempted to keep records for both options and ditch whatever is deemed unnecessary down the line.

Self referencing could clearly be more useful with nested subtasks but will take longer to code and maintain. The KISS principle keeps springing to mind!
 

Users who are viewing this thread

Back
Top Bottom