core PK: id 8 required 1 unique

Description

A join record linking a user to a mentor program session with per-day attendance tracking. Supports the structured multi-day workshop format used by Blindeforbundet's career workshop program. Coordinators manage participant lists and mark attendance per session day.

10
Attributes
4
Indexes
6
Validation Rules
14
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Unique identifier for this participant record (primary key).
PKrequiredunique
session_id uuid Foreign key referencing the mentor_program_sessions record this participant is enrolled in.
required
user_id uuid Foreign key referencing the users record of the enrolled participant.
required
days_attended json Array of day numbers (1-indexed) indicating which days of the multi-day workshop this participant attended. Example: [1, 2] means attended both days of a 2-day session. Empty array means enrolled but no attendance marked yet.
required
enrolled_at datetime Timestamp when this participant was added to the session. Set automatically on record creation.
required
enrolled_by_user_id uuid Foreign key referencing the users record of the coordinator who enrolled this participant. Null if the participant self-enrolled.
-
status enum Current enrollment status of the participant for this session.
required
notes text Optional coordinator notes about this participant's attendance or progress in the session. Not visible to the participant.
-
created_at datetime Timestamp of record creation. Managed by the database.
required
updated_at datetime Timestamp of last record modification. Updated automatically on every write.
required

Database Indexes

idx_workshop_participant_session_user
btree unique

Columns: session_id, user_id

idx_workshop_participant_session_id
btree

Columns: session_id

idx_workshop_participant_user_id
btree

Columns: user_id

idx_workshop_participant_status
btree

Columns: session_id, status

Validation Rules

session_id_exists error

Validation failed

user_id_exists error

Validation failed

days_attended_is_valid_json_array error

Validation failed

days_attended_no_duplicates warning

Validation failed

notes_length_limit error

Validation failed

status_enum_value error

Validation failed

Business Rules

unique_enrollment_per_session
on_create

A user may only have one workshop_participant record per mentor_program_session. Re-enrollment after withdrawal creates a new record and sets status back to 'enrolled'; the old record is soft-replaced rather than hard-deleted to preserve audit history.

days_attended_within_session_duration
on_update

Each day number in the days_attended array must be between 1 and the parent session's duration_days value. Day numbers outside that range are rejected.

status_derived_from_days_attended
on_update

The status field is kept consistent with days_attended: if days_attended covers all session days → 'attended'; covers some → 'partial'; empty array with enrolled status → 'enrolled'; no days and not withdrawn → 'absent' after session end date passes.

Enforced by: Mentor Program Service
coordinator_only_enrollment
on_create

Only users with the Coordinator or Organization Administrator role may add or remove participants from a session. Peer Mentors cannot self-enroll; enrollment is managed entirely by coordinators.

no_enrollment_in_archived_session
on_create

New participant records cannot be created for sessions that have been archived. Existing records may still be updated (e.g., marking attendance retrospectively) if the coordinator has appropriate role.

enrolled_at_not_after_session_end
on_create

Enrollment is allowed up to and including the final day of the session. Coordinators may back-date enrollment for participants who attended without prior registration.

Enforced by: Mentor Program Service

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Entity Relationships

mentor_program_session
incoming one_to_many

A mentor program session has many participant records tracking attendance per session day

required cascade delete
user
incoming one_to_many

A user can participate in multiple mentor program workshop sessions

required