Index

public.completion_registration_credit_justifications

Description

Why a student wants their credits in the study registry when a certificate would have served and enrolling will cost them a manual identity check. Collected on the completion registration page, from the one branch that reaches the question, to tell us how common that situation is. Advisory and free text: nothing reads it to decide anything, and it neither gates nor speeds up the registration the student then goes on to make. Kept apart from course_module_completions because a completion is a graded fact and this is one person’s answer to a question about it. Student-written prose about their own circumstances, so users.delete_user hard-deletes these rows with the account.

Columns

Name Type Default Nullable Children Parents Comment
course_module_completion_id uuid true public.course_module_completions The completion the student was registering when they answered. Unique among live rows: the answer is replaced rather than versioned, and a student who completes the module again starts without one. NULL when the answer is about a mooc.fi completion.
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.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
justification text false What the student wrote. Required to get past the question, but never checked or acted on: a student who changes an earlier answer afterwards leaves the row behind, and it stays as the answer they gave at the time.
moocfi_completion_id uuid true The mooc.fi completion the student answered about, by its mooc.fi id rather than an external_completions row, which a tier change replaces. Unique per user among live rows. NULL when the answer is about a course module completion.
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 The student who answered. Always the completion’s own user; stored so the rows can be scoped to a user without joining, which account deletion needs.

Constraints

Name Type Definition
completion_registration_credit_course_module_completion_id_fkey FOREIGN KEY FOREIGN KEY (course_module_completion_id) REFERENCES course_module_completions(id)
completion_registration_credit_justifica_justification_not_null n NOT NULL justification
completion_registration_credit_justificatio_created_at_not_null n NOT NULL created_at
completion_registration_credit_justificatio_updated_at_not_null n NOT NULL updated_at
completion_registration_credit_justifications_id_not_null n NOT NULL id
completion_registration_credit_justifications_one_subject CHECK CHECK ((num_nonnulls(course_module_completion_id, moocfi_completion_id) = 1))
completion_registration_credit_justifications_pkey PRIMARY KEY PRIMARY KEY (id)
completion_registration_credit_justifications_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id)
completion_registration_credit_justifications_user_id_not_null n NOT NULL user_id

Indexes

Name Definition
completion_registration_credit_justifications_pkey CREATE UNIQUE INDEX completion_registration_credit_justifications_pkey ON public.completion_registration_credit_justifications USING btree (id)
uq_completion_registration_credit_justifications_completion CREATE UNIQUE INDEX uq_completion_registration_credit_justifications_completion ON public.completion_registration_credit_justifications USING btree (course_module_completion_id, deleted_at) NULLS NOT DISTINCT WHERE (course_module_completion_id IS NOT NULL)
uq_completion_registration_credit_justifications_moocfi CREATE UNIQUE INDEX uq_completion_registration_credit_justifications_moocfi ON public.completion_registration_credit_justifications USING btree (user_id, moocfi_completion_id, deleted_at) NULLS NOT DISTINCT WHERE (moocfi_completion_id IS NOT NULL)

Triggers

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

Relations

er

Generated by tbls