Skip to content

Database tables for documents

This page lists the columns of artifacts, artifact_versions, blobs and comments. Database tables says how to read the columns.

A document or a link that belongs to a task. A document has a path. A link, such as a pull request or a preview, has a url.

Column Type Notes
id uuid key
team_id uuid references teams
task_id uuid references tasks
kind text one of document, link
path text optional
title text
made_by_session uuid optional; references sessions
made_by_person uuid optional; references people
url text optional
state text optional
current_version integer optional
created_at timestamptz default now()
updated_at timestamptz default now()

Unique (task_id, path) where (kind = 'document'). Check ((kind <> 'document') OR (path IS NOT NULL)). Check ((kind <> 'link') OR (url IS NOT NULL)).

One version of a document. A version holds text in content, or points at a row of blobs and holds none.

Column Type Notes
artifact_id uuid references artifacts
version integer
content text
author_session uuid optional; references sessions
author_person uuid optional; references people
created_at timestamptz default now()
blob_id uuid optional; references blobs

Primary key (artifact_id, version). Check ((blob_id IS NULL) OR (content = '')).

The bytes of image, PDF, video, audio and Office documents, once for each team and content. They live apart from artifact_versions so that no sync shape reads them.

Column Type Notes
id uuid key
team_id uuid references teams
sha256 text
media_type text one of image/png, image/jpeg, image/webp, image/gif, application/pdf, video/mp4, video/webm, audio/mpeg, audio/wav, audio/webm, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.presentationml.presentation
size_bytes integer
data bytea
created_at timestamptz default now()

Unique (team_id, sha256). Check ((size_bytes >= 1) AND (size_bytes <= 5242880)). Check (octet_length(data) = size_bytes). Check (sha256 ~ '^[0-9a-f]{64}$').

A comment on a document. A reply has a parent_id. sent_to_session names the session the comment was sent to.

Column Type Notes
id uuid key
team_id uuid references teams
artifact_id uuid references artifacts
version integer
anchor jsonb optional
parent_id uuid optional; references comments
author_person uuid optional; references people
author_session uuid optional; references sessions
body text
status text default 'open'; one of open, resolved, outdated
sent_to_session uuid optional; references sessions
created_at timestamptz default now()