Table: Schedule_Item_Assignment
Columns
NameTypeConstraintsDescription
schedule_item_assignment_KEYintNOT NULL
update__staff_KEYintNOT NULL
staff_KEYintNOT NULLWhich staff is assigned.
schedule_item_KEYintNOT NULLWhich schedule item this assignment is for.
budgeted_hoursdecimal (9, 2)NOT NULLMust be greater than or equal to zero, or -1.00 (to indicate assignment only without a budget.)
schedule_item_assignment_rankintNOT NULLThis is a ranking per [staff_KEY] of which schedule items to do first. Duplicates are allowed to reduce concurrency issues. A value of 999999999 indicates the assignment is not ranked.
is_primary_assignmentbitNOT NULLExactly one record per [schedule_item_KEY] should be set to true.
create__changeset_KEYintNOT NULL
update__changeset_KEYintNOT NULL
Primary key
NameColumnsDescription
PK_Schedule_Item_Assignment$staff_KEY$schedule_item_KEYstaff_KEY, schedule_item_KEYCLUSTERED
Unique constraints
NameColumnsDescription
UK_Schedule_Item_Assignment$schedule_item_assignment_KEYschedule_item_assignment_KEYThis is the old ptimary key for backwards compatibility until the schedule_item_assignment_KEY can be removed.
Indexes
NameColumnsDescription
IX_Schedule_Item_Assignment$schedule_item_assignment_rank@schedule_item_KEY@staff_KEYschedule_item_assignment_rank, schedule_item_KEY, staff_KEYThis index helps compute schedule_item_assignment_active_rank because that is only computed when schedule_item_assignment_rank is less than 999999999.
IX_Schedule_Item_Assignment$schedule_item_KEY$staff_KEY@@@schedule_item_KEY, staff_KEY, budgeted_hours, is_primary_assignment, schedule_item_assignment_KEY, schedule_item_assignment_rank, update__staff_KEYThis is unique by schedule_item_KEY and staff_KEY and includes all the other columns of the table so that it covers all queries by schedule_item_KEY.
Foreign keys
NameColumnsReferenced tableDescription
FK_Schedule_Item_Assignment__Schedule_Item__schedule_item_KEYschedule_item_KEYSchedule_Itemon delete cascade;
FK_Schedule_Item_Assignment__Staff__staff_KEYstaff_KEYStaffon delete cascade;

Schema diagram