Index

public.exercise_answer_snapshots

Description

Ungraded copies of a student’s answer stored through the exercise-services client API. Kept apart from exercise_slide_submissions so that nothing that grades, counts tries, awards points, picks peer reviews or computes completion can see them.

Columns

Name Type Default Nullable Children Parents Comment
course_id uuid false public.courses The course the exercise belongs to. Not null because exam exercises cannot have snapshots.
created_at timestamp with time zone now() false Timestamp when the record was created.
data_json jsonb true The exercise service’s own JSON about the answer’s files, opaque to the host. Null when the files are the whole answer.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted. Backups beyond the per-exercise cap are deleted oldest first.
exercise_id uuid false public.exercises The exercise the answer is for.
exercise_slide_id uuid false public.exercise_slides The slide the answer is for.
exercise_task_id uuid false public.exercise_tasks The task the answer is for.
id uuid uuid_generate_v4() false public.exercise_answer_snapshot_files public.exercise_slide_submission_shares A unique, stable identifier for the record. Random like exercise slide submission ids, which lets the client API take either kind of id on the same routes.
purpose exercise_answer_snapshot_purpose false Why the snapshot was stored.
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 whose answer this is.

Constraints

Name Type Definition
exercise_answer_snapshots_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
exercise_answer_snapshots_course_id_not_null n NOT NULL course_id
exercise_answer_snapshots_created_at_not_null n NOT NULL created_at
exercise_answer_snapshots_exercise_id_fkey FOREIGN KEY FOREIGN KEY (exercise_id) REFERENCES exercises(id)
exercise_answer_snapshots_exercise_id_not_null n NOT NULL exercise_id
exercise_answer_snapshots_exercise_slide_id_fkey FOREIGN KEY FOREIGN KEY (exercise_slide_id) REFERENCES exercise_slides(id)
exercise_answer_snapshots_exercise_slide_id_not_null n NOT NULL exercise_slide_id
exercise_answer_snapshots_exercise_task_id_fkey FOREIGN KEY FOREIGN KEY (exercise_task_id) REFERENCES exercise_tasks(id)
exercise_answer_snapshots_exercise_task_id_not_null n NOT NULL exercise_task_id
exercise_answer_snapshots_id_not_null n NOT NULL id
exercise_answer_snapshots_pkey PRIMARY KEY PRIMARY KEY (id)
exercise_answer_snapshots_purpose_not_null n NOT NULL purpose
exercise_answer_snapshots_updated_at_not_null n NOT NULL updated_at
exercise_answer_snapshots_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id)
exercise_answer_snapshots_user_id_not_null n NOT NULL user_id

Indexes

Name Definition
exercise_answer_snapshots_pkey CREATE UNIQUE INDEX exercise_answer_snapshots_pkey ON public.exercise_answer_snapshots USING btree (id)
idx_exercise_answer_snapshots_user_exercise CREATE INDEX idx_exercise_answer_snapshots_user_exercise ON public.exercise_answer_snapshots USING btree (user_id, exercise_id, created_at) WHERE (deleted_at IS NULL)

Triggers

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

Relations

er

Generated by tbls