Index

public.pending_roles

Description

A role that will be added for a user once they login to the system. Limited to course and course instance roles for security reasons

Columns

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 When the pending role expires. Expiration is important to minimize the chance of someone impersonating a user.
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.
expires_at timestamp with time zone (now() + ‘14 days’::interval) false
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
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.

Constraints

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_pkey PRIMARY KEY PRIMARY KEY (id)
single_role_for_domain CHECK CHECK ((num_nonnulls(course_instance_id, course_id) = 1))

Indexes

Name Definition
pending_roles_pkey CREATE UNIQUE INDEX pending_roles_pkey ON public.pending_roles USING btree (id)

Triggers

Name Definition
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.pending_roles FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls