Index

public.chapter_lock_action_logs

Description

Stores teacher-initiated chapter lock/unlock actions for students.

Columns

Name Type Default Nullable Children Parents Comment
actor_user_id uuid true public.users Teacher user id who performed the action. Nullable for system actions.
chapter_id uuid false public.chapters Chapter whose lock status was changed.
course_id uuid false public.courses Course where the chapter lock action happened.
created_at timestamp with time zone now() false Timestamp when the log entry was created.
deleted_at timestamp with time zone true Soft delete timestamp. Null means active log entry.
id uuid gen_random_uuid() false Unique identifier for a chapter lock action log entry.
status chapter_locking_status false Chapter locking status after the teacher action (same values as user_chapter_locking_statuses.status).
target_user_id uuid false public.users Student user id whose chapter lock status was changed.
updated_at timestamp with time zone now() false Timestamp when the log entry was last updated by trigger_set_timestamp.

Constraints

Name Type Definition
chapter_lock_action_logs_actor_user_id_fkey FOREIGN KEY FOREIGN KEY (actor_user_id) REFERENCES users(id)
chapter_lock_action_logs_chapter_id_fkey FOREIGN KEY FOREIGN KEY (chapter_id) REFERENCES chapters(id)
chapter_lock_action_logs_chapter_id_not_null n NOT NULL chapter_id
chapter_lock_action_logs_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
chapter_lock_action_logs_course_id_not_null n NOT NULL course_id
chapter_lock_action_logs_created_at_not_null n NOT NULL created_at
chapter_lock_action_logs_id_not_null n NOT NULL id
chapter_lock_action_logs_pkey PRIMARY KEY PRIMARY KEY (id)
chapter_lock_action_logs_status_not_null n NOT NULL status
chapter_lock_action_logs_target_user_id_fkey FOREIGN KEY FOREIGN KEY (target_user_id) REFERENCES users(id)
chapter_lock_action_logs_target_user_id_not_null n NOT NULL target_user_id
chapter_lock_action_logs_updated_at_not_null n NOT NULL updated_at

Indexes

Name Definition
chapter_lock_action_logs_pkey CREATE UNIQUE INDEX chapter_lock_action_logs_pkey ON public.chapter_lock_action_logs USING btree (id)
idx_chapter_lock_action_logs_chapter_id CREATE INDEX idx_chapter_lock_action_logs_chapter_id ON public.chapter_lock_action_logs USING btree (chapter_id)
idx_chapter_lock_action_logs_course_id CREATE INDEX idx_chapter_lock_action_logs_course_id ON public.chapter_lock_action_logs USING btree (course_id)
idx_chapter_lock_action_logs_target_user_id CREATE INDEX idx_chapter_lock_action_logs_target_user_id ON public.chapter_lock_action_logs USING btree (target_user_id)

Triggers

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

Relations

er

Generated by tbls