コンテンツにスキップ

public.user_answers

Description

Columns

Name Type Default Nullable Children Parents Comment
id bigint nextval('user_answers_id_seq'::regclass) false
user_id bigint false public.users
question_id bigint false public.questions
workbook_id bigint false public.workbooks
selected_choice integer false
is_correct boolean false
answered_at timestamp with time zone CURRENT_TIMESTAMP true

Constraints

Name Type Definition
user_answers_id_not_null n NOT NULL id
user_answers_is_correct_not_null n NOT NULL is_correct
user_answers_question_id_not_null n NOT NULL question_id
user_answers_selected_choice_not_null n NOT NULL selected_choice
user_answers_user_id_not_null n NOT NULL user_id
user_answers_workbook_id_not_null n NOT NULL workbook_id
user_answers_question_id_fkey FOREIGN KEY FOREIGN KEY (question_id) REFERENCES questions(id) ON DELETE CASCADE
user_answers_workbook_id_fkey FOREIGN KEY FOREIGN KEY (workbook_id) REFERENCES workbooks(id) ON DELETE CASCADE
user_answers_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
user_answers_pkey PRIMARY KEY PRIMARY KEY (id)

Indexes

Name Definition
user_answers_pkey CREATE UNIQUE INDEX user_answers_pkey ON public.user_answers USING btree (id)
idx_user_answers_user_id CREATE INDEX idx_user_answers_user_id ON public.user_answers USING btree (user_id)
idx_user_answers_user_question CREATE INDEX idx_user_answers_user_question ON public.user_answers USING btree (user_id, question_id)
idx_user_answers_user_workbook CREATE INDEX idx_user_answers_user_workbook ON public.user_answers USING btree (user_id, workbook_id)

Relations

er


Generated by tbls