Skip to main content

leavemanagement

Table: leavemanagement

The leavemanagement table records employee leave information.
It tracks leave types, dates, approval details, and audit information for each staff member.


Columns

Column NameData TypeConstraintsDescription
mappedIdint(11)NOT NULLID of the employee taking leave (references idmapper.mappedId)
leaveTypevarchar(45)NOT NULLType of leave (e.g., Sick, Casual, Annual)
leaveDatedateNOT NULLDate of the leave
createdByUserIdint(11)NULLID of the user who created the leave record (references user.mappedId)
lastEditedByUserIdint(11)NULLID of the user who last edited the leave record (references user.mappedId)
leaveIdint(11)NOT NULL, AUTO_INCREMENTPrimary identifier for the leave record
voidedint(11)DEFAULT 0Flag indicating if the leave record is voided (0 = active, 1 = voided)
additionalNotevarchar(255)NULLAny additional notes for the leave
approvedByNamevarchar(255)NULLName of the approver for the leave
approvedByRolevarchar(255)NULLRole/designation of the approver
leaveReasonvarchar(255)NULLReason provided for the leave
createdDatedatetimeNULLTimestamp when the leave record was created
lastEditedDatedatetimeNULLTimestamp when the leave record was last edited
voideDatedatetimeNULLTimestamp when the record was voided
voidedReasonvarchar(255)NULLReason for voiding the leave record
shiftStatusvarchar(45)NULLStatus of the shift during the leave (if applicable)

Indexes

  1. PRIMARY - Implicit via leaveId (auto-incremented)
  2. UNIQUE - YourTable_unique on (mappedId, leaveDate)
  3. createdUserId_fk_idx - Index on createdByUserId
  4. editedUserId_fk_idx - Index on lastEditedByUserId
  5. FK438A0E3ABF05F133 - Index on leaveId

Foreign Key Relations

  1. createdUserId_fkuser.mappedId

    • Links the record to the user who created it
  2. editedUserId_fkuser.mappedId

    • Links the record to the user who last edited it
  3. mappedIdIdMapper_pk_fkidmapper.mappedId

    • Links the leave record to the employee in the ID mapping table

Usage Notes

  • Tracks leave requests for employees including type, reason, approval, and shift impact.
  • voided and voidedReason help manage cancelled or corrected leave entries.
  • Unique constraint on mappedId and leaveDate prevents duplicate leave records for the same employee on the same day.
  • Indexed for efficient retrieval by creator, editor, or leave record ID.