Index

public.user_course_settings

Description

User setting for a language version group of courses.

Columns

Name Type Default Nullable Children Parents Comment
course_language_group_id uuid false public.course_language_groups public.courses Group of courses that these settings are used for.
created_at timestamp with time zone now() false Timestamp when the record was created.
current_course_id uuid false public.courses public.course_instance_enrollments Current course language version that the user is on. Used as a constraint for valid course instance.
current_course_instance_id uuid false public.course_instances public.course_instance_enrollments Current course instance that the user is on.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted.
hidden boolean false false Whether the user has hidden this course from their personal “My courses” list. Does not affect course progress and is reset to false when the user next visits the course material.
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.users public.course_instance_enrollments The user that these settings should be applied for.

Constraints

Name Type Definition
user_course_settings_course_language_group_id_fkey FOREIGN KEY FOREIGN KEY (course_language_group_id) REFERENCES course_language_groups(id)
user_course_settings_course_language_group_id_not_null n NOT NULL course_language_group_id
user_course_settings_created_at_not_null n NOT NULL created_at
user_course_settings_current_course_id_course_language_gro_fkey FOREIGN KEY FOREIGN KEY (current_course_id, course_language_group_id) REFERENCES courses(id, course_language_group_id)
user_course_settings_current_course_id_fkey FOREIGN KEY FOREIGN KEY (current_course_id) REFERENCES courses(id)
user_course_settings_current_course_id_not_null n NOT NULL current_course_id
user_course_settings_current_course_instance_id_fkey FOREIGN KEY FOREIGN KEY (current_course_instance_id) REFERENCES course_instances(id)
user_course_settings_current_course_instance_id_not_null n NOT NULL current_course_instance_id
user_course_settings_hidden_not_null n NOT NULL hidden
user_course_settings_pkey PRIMARY KEY PRIMARY KEY (user_id, course_language_group_id)
user_course_settings_updated_at_not_null n NOT NULL updated_at
user_course_settings_user_id_current_course_id_current_cou_fkey FOREIGN KEY FOREIGN KEY (user_id, current_course_id, current_course_instance_id) REFERENCES course_instance_enrollments(user_id, course_id, course_instance_id)
user_course_settings_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id)
user_course_settings_user_id_not_null n NOT NULL user_id

Indexes

Name Definition
user_course_settings_current_course_id_idx CREATE INDEX user_course_settings_current_course_id_idx ON public.user_course_settings USING btree (current_course_id)
user_course_settings_current_course_instance_id_idx CREATE INDEX user_course_settings_current_course_instance_id_idx ON public.user_course_settings USING btree (current_course_instance_id)
user_course_settings_pkey CREATE UNIQUE INDEX user_course_settings_pkey ON public.user_course_settings USING btree (user_id, course_language_group_id)

Triggers

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

Relations

er

Generated by tbls