core PK: id 8 required 1 unique

Description

Records the enrollment of peer mentors and coordinators in training courses and workshops. Each registration links a user to a specific course, tracks enrollment status through its lifecycle (registered, waitlisted, attended, cancelled, no-show), and captures completion outcomes that feed into the certification pipeline.

17
Attributes
6
Indexes
8
Validation Rules
16
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Unique identifier for the course registration record
PKrequiredunique
course_id uuid Foreign key referencing the course the user is registering for
required
user_id uuid Foreign key referencing the user enrolling in the course
required
organization_id uuid Organization the user belongs to at time of registration, used for tenant-scoped queries and reporting
required
status enum Current lifecycle status of the registration
required
registration_date datetime Timestamp when the registration was created
required
confirmation_date datetime Timestamp when the registration was confirmed (moved from waitlist or auto-confirmed)
-
cancellation_date datetime Timestamp when the registration was cancelled by the user or admin
-
cancellation_reason text Optional reason provided when cancelling the registration
-
attendance_marked_at datetime Timestamp when attendance was recorded (by facilitator or system)
-
completion_date datetime Timestamp when the user completed the course, triggers certification eligibility check
-
completion_result enum Outcome of the course for the participant
-
waitlist_position integer Position in the waitlist queue when status is waitlisted, null otherwise
-
registered_by_user_id uuid User who performed the registration — differs from user_id when a coordinator registers on behalf of a peer mentor
-
notes text Free-text notes about the registration, such as dietary requirements or accessibility needs
-
created_at datetime Row creation timestamp
required
updated_at datetime Row last-modified timestamp
required

Database Indexes

idx_course_registrations_course_user
btree unique

Columns: course_id, user_id

idx_course_registrations_user
btree

Columns: user_id

idx_course_registrations_course_status
btree

Columns: course_id, status

idx_course_registrations_organization
btree

Columns: organization_id

idx_course_registrations_status
btree

Columns: status

idx_course_registrations_registration_date
btree

Columns: registration_date

Validation Rules

valid_course_reference error

Validation failed

valid_user_reference error

Validation failed

valid_status_transition error

Validation failed

completion_result_requires_attended error

Validation failed

cancellation_fields_consistency error

Validation failed

waitlist_position_consistency error

Validation failed

notes_length_check error

Validation failed

organization_matches_user error

Validation failed

Business Rules

no_duplicate_registration
on_create

A user may only have one active (non-cancelled) registration per course. The unique index on (course_id, user_id) enforces this at the database level; cancelled registrations must be soft-deleted or status-gated.

prerequisite_validation
on_create

Before creating a registration, the system must verify that the user has completed all prerequisite courses defined on the target course. Checked against existing course_registrations with status 'completed' and completion_result 'passed'.

capacity_enforcement
on_create

When a course reaches maximum capacity, new registrations are placed on the waitlist (status: waitlisted) with an assigned waitlist_position. When a registered participant cancels, the first waitlisted participant is auto-promoted to confirmed.

waitlist_promotion_on_cancel
on_update

When a registration is cancelled and the course has waitlisted participants, the participant with the lowest waitlist_position is automatically promoted to confirmed status and notified.

completion_triggers_certification
on_update

When a registration transitions to status 'completed' with completion_result 'passed', the certification pipeline checks if the user qualifies for a peer mentor certificate (via certification_types criteria).

cancellation_deadline
on_update

Registrations can only be cancelled before the course start date. Cancelling after the course has started sets status to 'no_show' instead of 'cancelled'.

Enforced by: Course Service
proxy_registration_authorization
on_create

A coordinator may register a peer mentor for a course only if both belong to the same organization. The registered_by_user_id field records the coordinator who performed the action.

organization_scoped_access
always

All queries to course_registrations must be scoped by organization_id. Coordinators see registrations within their local association; org admins see all registrations for their organization.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage