Index

public.agent_changeset_preview_links

Description

Login-free links that show a page of a course, or all of its pages, as published or as a changeset stages them. Each row is one link; only a hash of its token is stored, so reading the table does not reveal live links. Expired rows are deleted when a new link is minted.

Columns

Name Type Default Nullable Children Parents Comment
changeset_id uuid true public.agent_changesets The changeset whose staged state the link shows. NULL for a link to the published state.
course_id uuid false public.courses The course the link previews.
created_at timestamp with time zone now() false Timestamp when the record was created.
expires_at timestamp with time zone false When the link stops working.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
page_id uuid true The one page the link shows; not a foreign key because the page may exist only in the changeset. NULL for a link to all of the changeset’s changed pages, or to all pages of the course when there is no changeset.
token_hash bytea false SHA-256 of the random token in the link.
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 minted the link. The link works only while this user can edit the course and, with a changeset, still owns it.

Viewpoints

Name Definition
AI agent changesets How a teacher’s AI agent edits course material through the MCP server without touching what students see. Every agent write is staged in the teacher’s open changeset for the course and reaches students only when the changeset is published; each call is logged with what it changed so that it can be reverted, and saves from the web UI and agents alike leave history.

Constraints

Name Type Definition
agent_changeset_preview_links_changeset_id_fkey FOREIGN KEY FOREIGN KEY (changeset_id) REFERENCES agent_changesets(id)
agent_changeset_preview_links_course_id_fkey FOREIGN KEY FOREIGN KEY (course_id) REFERENCES courses(id)
agent_changeset_preview_links_course_id_not_null n NOT NULL course_id
agent_changeset_preview_links_created_at_not_null n NOT NULL created_at
agent_changeset_preview_links_expires_at_not_null n NOT NULL expires_at
agent_changeset_preview_links_id_not_null n NOT NULL id
agent_changeset_preview_links_pkey PRIMARY KEY PRIMARY KEY (id)
agent_changeset_preview_links_token_hash_key UNIQUE UNIQUE (token_hash)
agent_changeset_preview_links_token_hash_not_null n NOT NULL token_hash
agent_changeset_preview_links_updated_at_not_null n NOT NULL updated_at
agent_changeset_preview_links_user_id_fkey FOREIGN KEY FOREIGN KEY (user_id) REFERENCES users(id)
agent_changeset_preview_links_user_id_not_null n NOT NULL user_id

Indexes

Name Definition
agent_changeset_preview_links_pkey CREATE UNIQUE INDEX agent_changeset_preview_links_pkey ON public.agent_changeset_preview_links USING btree (id)
agent_changeset_preview_links_token_hash_key CREATE UNIQUE INDEX agent_changeset_preview_links_token_hash_key ON public.agent_changeset_preview_links USING btree (token_hash)
idx_agent_changeset_preview_links_changeset CREATE INDEX idx_agent_changeset_preview_links_changeset ON public.agent_changeset_preview_links USING btree (changeset_id)
idx_agent_changeset_preview_links_expires_at CREATE INDEX idx_agent_changeset_preview_links_expires_at ON public.agent_changeset_preview_links USING btree (expires_at)

Triggers

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

Relations

er

Generated by tbls