Table: Task
Columns
Name | Type | Constraints | Description
task_KEY | int | NOT NULL | AUTO-INCREMENT: Database assigned primary key for this table.
update__staff_KEY | int | NOT NULL |
update_date | datetime | NOT NULL |
create_date | datetime | NOT NULL |
project_KEY | int | NOT NULL | Key of the Project this Task belongs to.
completion_order | int | NOT NULL | The user defined order the tasks are to be completed in (not unique).
budgeted_amount | decimal (9, 2) | NOT NULL | Amount budgeted to this task.
actual_start_date | smalldatetime |  | The actual start date.
actual_complete_date | smalldatetime |  | The actual complete date.
target | nvarchar (1000) | NOT NULL | Target to execute. File name or url.
completion_event | nvarchar (50) | NOT NULL | Description of a "User" type client status event that will mark this Task as being complete.
row_version | timestamp | NOT NULL |
solution_type_name | nvarchar (50) | NOT NULL | Name of the type of solution that is used for this Task. The system has a finite set of solution type names defined.
completion_event_recorded_date | datetime | NOT NULL | Only completion events recorded after this date are eligible to complete this Task. When the completion event is used to complete the Task this value must be updated.
task_number | int | NOT NULL | Each Task will be assigned a number that is unique that the user can select.
project_template_KEY | int | NOT NULL | Key of the Project Template of the Project this Task belongs to, copied here so that Declarative Referential Integrity can be used between Task and Task_Template.
schedule_item_KEY | int | NOT NULL |
budgeted_amount_is_calculated | bit | NOT NULL |
task_template_KEY | int |  | The linked [Task_Template].
create__changeset_KEY | int | NOT NULL |
update__changeset_KEY | int | NOT NULL |

Primary key
Name | Columns | Description
PK_Task$task_KEY | task_KEY | CLUSTERED
Unique constraints
Name | Columns | Description
UK_Task$task_KEY$schedule_item_KEY | task_KEY, schedule_item_KEY | This unique constraint supports the relationship between task_KEY and task__schedule_item_KEY on Sheet_Entry.
UK_Task__project_template_KEY__task_KEY | project_template_KEY, task_KEY | This unique constraint supports the relationship from Project to Task to Task_Template where a Task_Template assigned to a Task must also be assigned the same Project_Template as the Project.
UK_Task__schedule_item_KEY | schedule_item_KEY |
UK_Task__task_KEY__project_KEY | task_KEY, project_KEY | This unique constraint supports the fact that if a Task is assigned to a Sheet Entry the Task must be for the same Project as the Project assigned to the Sheet Entry.
UK_Task__task_number | task_number | Each Task is assigned a unique number that the user should have some control over.
Indexes
Name | Columns | Description
IX_Task$project_KEY$project_template_KEY | project_KEY, project_template_KEY | Index supports foreign key FK_Task__Project__project_KEY__project_template_KEY
IX_Task$project_KEY@completion_order@schedule_item_KEY@task_KEY | project_KEY, completion_order, schedule_item_KEY, task_KEY | Covers the columns needed to compute whether a task is ready or not depending on the completion_order of tasks for a project.
IX_Task$project_template_KEY$task_template_KEY | project_template_KEY, task_template_KEY | Index supports foreign key FK_Task__Task_Template__project_template_KEY__task_template_KEY
IX_Task$schedule_item_KEY$project_KEY | schedule_item_KEY, project_KEY | Support getting Schedule_Item_View.current_due_date efficiently.
IX_Task$task_template_KEY | task_template_KEY |

Foreign keys
Name | Columns | Referenced table | Description
FK_Task__Project__project_KEY__project_template_KEY | project_KEY, project_template_KEY | Project | on delete cascade;
FK_Task__Schedule_Item__schedule_item_KEY | schedule_item_KEY | Schedule_Item |
FK_Task__Task_Template__project_template_KEY__task_template_KEY | project_template_KEY, task_template_KEY | Task_Template |
FK_Task__Task_Template__task_template_KEY | task_template_KEY | Task_Template | on delete set null;

Incoming foreign keys
Name | Columns | Referencing table | Description
FK_Sheet_Entry__Task__task_KEY__project_KEY | task_KEY, project_KEY | Sheet_Entry |
FK_Sheet_Entry__Task__task_KEY__task__schedule_item_KEY | task_KEY, task__schedule_item_KEY | Sheet_Entry |