A role granted to an email address that is not verified yet. It becomes a role once the account holding that address verifies it, and lapses at expires_at; until then a student who merely typed someone else’s address into their profile gets nothing.
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| course_id | uuid | true | public.courses | The course the role is for | ||
| course_instance_id | uuid | true | public.course_instances | The course instance the role is for | ||
| created_at | timestamp with time zone | now() | false | Timestamp when the record was created. | ||
| deleted_at | timestamp with time zone | true | Timestamp when the record was deleted. If null, the record is not deleted. | |||
| exam_id | uuid | true | public.exams | The exam the role is for | ||
| expires_at | timestamp with time zone | (now() + ‘14 days’::interval) | false | When the pending role expires. Expiration is important to minimize the chance of someone impersonating a user. | ||
| id | uuid | uuid_generate_v4() | false | A unique, stable identifier for the record. | ||
| is_global | boolean | false | false | Whether the role is global rather than for one organization, course, course instance or exam | ||
| organization_id | uuid | true | public.organizations | The organization the role is for | ||
| role | user_role | false | The role to be granted. | |||
| updated_at | timestamp with time zone | now() | false | Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger. | ||
| user_email | varchar(255) | false | Email the role will be granted to, compared case-insensitively. |
| Name | Type | Definition |
|---|---|---|
| pending_roles_course_id_fkey | FOREIGN KEY | FOREIGN KEY (course_id) REFERENCES courses(id) |
| pending_roles_course_instance_id_fkey | FOREIGN KEY | FOREIGN KEY (course_instance_id) REFERENCES course_instances(id) |
| pending_roles_created_at_not_null | n | NOT NULL created_at |
| pending_roles_exam_id_fkey | FOREIGN KEY | FOREIGN KEY (exam_id) REFERENCES exams(id) |
| pending_roles_expires_at_not_null | n | NOT NULL expires_at |
| pending_roles_id_not_null | n | NOT NULL id |
| pending_roles_is_global_not_null | n | NOT NULL is_global |
| pending_roles_organization_id_fkey | FOREIGN KEY | FOREIGN KEY (organization_id) REFERENCES organizations(id) |
| pending_roles_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| pending_roles_role_not_null | n | NOT NULL role |
| pending_roles_updated_at_not_null | n | NOT NULL updated_at |
| pending_roles_user_email_not_null | n | NOT NULL user_email |
| single_role_for_domain | CHECK | CHECK ((((num_nonnulls(organization_id, course_id, course_instance_id, exam_id) = 1) AND (is_global = false)) OR ((num_nonnulls(organization_id, course_id, course_instance_id, exam_id) = 0) AND (is_global = true)))) |
| Name | Definition |
|---|---|
| pending_roles_pkey | CREATE UNIQUE INDEX pending_roles_pkey ON public.pending_roles USING btree (id) |
| pending_roles_user_email_idx | CREATE INDEX pending_roles_user_email_idx ON public.pending_roles USING btree (lower((user_email)::text)) WHERE (deleted_at IS NULL) |
| Name | Definition |
|---|---|
| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.pending_roles FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() |
Generated by tbls