Skip to main content
Prefix: hr_
Table Count: 85
Last Updated: 2026-02-08

Overview

The HR module covers employee records, recruitment (ATS), onboarding/offboarding, time and attendance, leave, payroll, benefits, credentials, skills, and employee relations.

Table Categories

1. Core Employee Management (5 tables)

Key Fields in hr_employees:
  • employee_number: Unique identifier
  • status: ‘active’, ‘inactive’, ‘terminated’, ‘on_leave’
  • employment_type: ‘full_time’, ‘part_time’, ‘contractor’, ‘intern’
  • ssn_encrypted: Encrypted SSN (column-level encryption)
  • custom_fields: JSONB for org-specific data
Relationships:

2. Recruitment / ATS (10 tables)

Hiring Pipeline:

3. Onboarding & Offboarding (6 tables)

4. Time & Attendance (9 tables)

Time Entry Pattern:

5. Leave Management (5 tables)

Leave Types:
  • PTO (Paid Time Off)
  • Sick Leave
  • Vacation
  • Personal
  • FMLA
  • Bereavement
  • Jury Duty
  • Military

6. Payroll (9 tables)

Security Notes:
  • SSN stored with column-level encryption
  • All SSN access logged to hr_ssn_access_log
  • Payroll changes tracked in hr_payroll_audit_log

7. Benefits (6 tables)

8. Credentials & Certifications (5 tables)

Credential Tracking:

9. Skills & Competencies (6 tables)

10. Positions (1 table)

Position Fields:
  • title, description, department_id
  • pay_grade, min_salary, max_salary
  • reports_to_position_id (hierarchy)
  • headcount_authorized, headcount_filled

11. Employee Relations (4 tables)

ER Workflow:

12. Workload Planning (8 tables)

13. Module Settings (1 table)

14. ATS Enhanced (10 tables)

Reference Checking Workflow:
Background Check DLQ Pattern:
Key Settings:

Common Query Patterns

Get Team Members

Leave Balance Check


RLS Policies

HR tables use layered RLS:
  1. Organization isolation via organization_id
  2. Manager access to direct reports
  3. Self-service for employee’s own data
  4. HR admin access for sensitive operations
Helper Functions:
  • hr_user_can_view_employee() - View permission check
  • hr_user_can_edit_employee() - Edit permission check
  • hr_user_is_manager_of() - Manager relationship check

Sensitive Data Handling


See Also