user_roles table
The user_roles table in the Learning Management System Database Schema schema has 4 columns, with 3 foreign keys to users, roles and courses.
course_id null is a global role; set, it is scoped to one course. That single nullable column is what makes per-course instructors work.
Columns (4)
| Column | Type | Constraints | Description |
|---|---|---|---|
| user_id | uuid | not null, references users.id | |
| role_id | uuid | not null, references roles.id | |
| course_id | uuid | references courses.id | |
| granted_at | timestamptz | not null |
Indexes (1)
(course_id, role_id)
Relationships
user_roles.user_idreferencesusers.iduser_roles.role_idreferencesroles.iduser_roles.course_idreferencescourses.id