[thelist] Representing tasks in the database

Matt Warden mwarden at gmail.com
Thu Apr 26 10:54:57 CDT 2007

On 4/26/07, Joel D Canfield <joel at streamliine.com> wrote:
> > I'm looking for general ideas at this point.  Or maybe someone that
> > says "Hey, I just did this!"
> I built an org chart by just including a field 'supervisor' and made it reference the employee id in the same table
> you could have a field 'precedent' for each task, pointing to the unique identifier of the task on which it depends. self-creating chain.
> unless you have two unrelated precedents to our task, in which case you'll need a linking table, and be creating two chains backwards from said task.

Be careful. The data model you're suggesting will not enforce good
data. For example:

Task           Precedent
1                    3
2                    1
3                    2

In words: task 3 must be completed before task 1, task 1 must be
completed before task 2, and task 2 must be completed before task 3.
See the problem?

In this case, your code can be written in a way that errors out in
this case, but it can't be written in a way that makes sense of this
data. You would really need to include application code that makes
sure this data does not get entered in the first place. This may be
simple if you have a single interface for this data entry, and it may
be very complex if you have batch jobs and other things going on
(doesn't sound applicable to the OP's situation, thankfully).

Matt Warden
Cleveland, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list