Index

public.courses

Description

Collection of course materials and exercises that define a online course.

Columns

Name Type Default Nullable Children Parents Comment
base_module_completion_requires_n_submodule_completions integer 0 false For courses that use a modular structure, this is the amount of additional modules that need to be completed in addition to the base module before the student is able to receive any credit for the course.
content_search_language varchar(255) ‘simple’::character varying false Language that will be used for stemming for full text search. Copied to pages.content_search_language where it’s used in triggers. Has to be a value from pg_ts_config.cfgname.
copied_from uuid true public.courses The original course that this course is a copy of. If null, this is the original course.
course_language_group_id uuid false public.user_course_settings public.course_language_groups Course group that this language version is a part of.
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.
description text true
id uuid uuid_generate_v4() false public.chapters public.course_background_questions public.course_exams public.course_instance_enrollments public.course_instances public.course_module_completion_registered_to_study_registries public.course_module_completions public.course_modules public.course_specific_consent_form_answers public.course_specific_consent_form_questions public.course_specific_research_consent_forms public.courses public.exercise_repositories public.exercise_slide_submissions public.exercise_task_gradings public.exercises public.feedback public.glossary public.material_references public.other_domain_to_course_redirections public.page_visit_datum public.page_visit_datum_summary_by_courses public.page_visit_datum_summary_by_courses_countries public.page_visit_datum_summary_by_courses_device_types public.page_visit_datum_summary_by_pages public.pages public.peer_or_self_review_configs public.pending_roles public.proposed_page_edits public.roles public.student_countries public.url_redirections public.user_course_settings A unique, stable identifier for the record.
is_draft boolean false false Marks whether the course is a draft or not. Draft courses are only visible to authorized users.
is_test_mode boolean false false Marks whether the course is in test mode. Test mode courses have a notification on each page in the material.
is_unlisted boolean false false If true, the course is not listed on the organization page but students with a direct link to the course can access it.
language_code varchar(15) false IETF language code identifier for the course
name varchar(255) false Human readable name of the course e.g. “Introduction to Birds”.
organization_id uuid false public.organizations Organization that manages and organizes this course.
slug varchar(255) “substring”(md5((random())::text), 0, 15) false A unique abbreviation of the course name that is visible in URLs e.g. “introduction-to-birds”.
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.

Constraints

Name Type Definition
course_language_group_id_and_language_code_uniqueness UNIQUE UNIQUE NULLS NOT DISTINCT (course_language_group_id, language_code, deleted_at)
courses_copied_from_fkey FOREIGN KEY FOREIGN KEY (copied_from) REFERENCES courses(id)
courses_course_language_group_id_fkey FOREIGN KEY FOREIGN KEY (course_language_group_id) REFERENCES course_language_groups(id)
courses_language_code_check CHECK CHECK (((language_code)::text ~ ‘1{2,3}(-[A-Z][a-z]{3})?-[A-Z]{2}$’::text))
courses_organization_id_fkey FOREIGN KEY FOREIGN KEY (organization_id) REFERENCES organizations(id)
courses_pkey PRIMARY KEY PRIMARY KEY (id)
courses_slug_key_when_not_deleted UNIQUE UNIQUE NULLS NOT DISTINCT (slug, deleted_at)
unlisted_xor_draft CHECK CHECK ((NOT (is_unlisted AND is_draft)))

Indexes

Name Definition
course_language_group_id_and_language_code_uniqueness CREATE UNIQUE INDEX course_language_group_id_and_language_code_uniqueness ON public.courses USING btree (course_language_group_id, language_code, deleted_at) NULLS NOT DISTINCT
courses_pkey CREATE UNIQUE INDEX courses_pkey ON public.courses USING btree (id)
courses_slug_key_when_not_deleted CREATE UNIQUE INDEX courses_slug_key_when_not_deleted ON public.courses USING btree (slug, deleted_at) NULLS NOT DISTINCT
courses_user_course_settings_key CREATE UNIQUE INDEX courses_user_course_settings_key ON public.courses USING btree (id, course_language_group_id)

Triggers

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

Relations

er

Generated by tbls


  1. a-z↩︎