Index

public.course_background_question_answers

Description

An answer to a background question. A single user can have only one answer to one question.

Columns

Name Type Default Nullable Children Parents Comment
answer_value varchar(512) true What the student answered.
course_background_question_id uuid false public.course_background_questions The question being answered.
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.
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 user who answered this question.

Constraints

Name Type Definition
course_background_question_an_course_background_question_i_fkey FOREIGN KEY FOREIGN KEY (course_background_question_id) REFERENCES course_background_questions(id)
course_background_question_answers_pkey PRIMARY KEY PRIMARY KEY (id)
course_background_question_answers_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id)
unique_background_question_answers UNIQUE UNIQUE NULLS NOT DISTINCT (course_background_question_id, user_id, deleted_at)

Indexes

Name Definition
course_background_question_answers_pkey CREATE UNIQUE INDEX course_background_question_answers_pkey ON public.course_background_question_answers USING btree (id)
unique_background_question_answers CREATE UNIQUE INDEX unique_background_question_answers ON public.course_background_question_answers USING btree (course_background_question_id, user_id, deleted_at) NULLS NOT DISTINCT

Triggers

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

Relations

er

Generated by tbls