Index

public.course_instance_enrollments

Description

Tells in which of the courses many instances certain user has enrolled to. The relationship defines to which instance we should associate the student’s submissions and scores.

Columns

Name Type Default Nullable Children Parents Comment
course_id uuid false public.student_countries public.user_course_settings public.courses
course_instance_id uuid false public.student_countries public.user_course_settings public.course_instances The course instance where the user has enrolled to. Part of the primary key.
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.
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_id uuid false public.student_countries public.user_course_settings public.users The user that has enrolled to a course instance. Part of the primary key.

Constraints

Name Type Definition
course_instance_enrollments_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
course_instance_enrollments_course_instance_id_fkey FOREIGN KEY FOREIGN KEY (course_instance_id) REFERENCES course_instances(id)
course_instance_enrollments_pkey PRIMARY KEY PRIMARY KEY (user_id, course_instance_id)
course_instance_enrollments_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id)

Indexes

Name Definition
course_instance_enrollments_pkey CREATE UNIQUE INDEX course_instance_enrollments_pkey ON public.course_instance_enrollments USING btree (user_id, course_instance_id)
course_instance_enrollments_user_course_settings_key CREATE UNIQUE INDEX course_instance_enrollments_user_course_settings_key ON public.course_instance_enrollments USING btree (user_id, course_id, course_instance_id)

Triggers

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

Relations

er

Generated by tbls