Database Reference

This page lists Ink's domain tables. All tables live in your own Supabase project. RLS is enabled on every table.

Shared platform tables

  • profiles — user metadata.
  • workspaces — tenant boundary.
  • workspace_members — user ↔ workspace with role.

Ink domain tables

spaces

ColumnTypeNotes
iduuid PK
workspace_iduuid FK → workspaces
nametext
slugtextURL slug.
icontextEmoji or storage path.
visibilitytextprivate, workspace, public.
default_roletextRole applied when visibility = workspace.
is_archivedbool
created_byuuid FK → auth.users

space_members

ColumnTypeNotes
space_iduuid FK → spaces
user_iduuid FK → auth.users
roletextadmin, editor, commenter, viewer.

pages

ColumnTypeNotes
iduuid PK
workspace_iduuid FK → workspaces
space_iduuid FK → spaces
parent_page_iduuid FK → pagesNull for root-level pages.
titletext
slugtextURL slug within space.
positionintSibling ordering.
icontext
publishedbool
published_slugtextPublic URL slug.
published_metajsonbSEO metadata.
is_archivedbool
created_byuuid FK → auth.users
updated_attimestamptz

blocks

ColumnTypeNotes
iduuid PK
page_iduuid FK → pages
parent_block_iduuid FK → blocksNull for root-level blocks.
positionnumericFractional positioning for conflict-free reordering.
typetextparagraph, heading, code, table, toggle, ...
datajsonbType-specific payload.
created_attimestamptz
updated_attimestamptz

page_versions

Version history for pages.

ColumnTypeNotes
iduuid PK
page_iduuid FK → pages
snapshotjsonbFull block tree at that point in time.
author_iduuid FK → auth.users
created_attimestamptz

Pruned nightly by ink-version-pruner beyond the retention window.

tags

ColumnTypeNotes
iduuid PK
workspace_iduuid FK → workspaces
nametextNormalized lowercase.
colortextHex.
group_iduuid FK → tag_groupsNullable.
is_reservedbool

tag_groups

ColumnTypeNotes
iduuid PK
workspace_iduuid FK → workspaces
nametext

page_tags

Join table.

ColumnTypeNotes
page_iduuid FK → pages
tag_iduuid FK → tags

comments

ColumnTypeNotes
iduuid PK
page_iduuid FK → pages
parent_iduuid FK → commentsNull for top-level.
author_iduuid FK → auth.users
bodytextMarkdown.
resolvedbool
resolved_byuuid FK → auth.users
resolved_attimestamptz
created_attimestamptz

comment_anchors

ColumnTypeNotes
comment_iduuid FK → comments
block_iduuid FK → blocksNullable.
selectionjsonbText range within the block.
ColumnTypeNotes
iduuid PK
page_iduuid FK → pages
tokentextRandom id used in URL.
roletextviewer, commenter, editor.
expires_attimestamptz
password_hashtextNull if no password.
require_emailbool
created_byuuid FK → auth.users
revoked_attimestamptzNull if active.

Audit log for external share-link access.

Bidirectional link graph between pages (populated by a trigger when a page body references another page).

ColumnTypeNotes
source_page_iduuid FK → pages
target_page_iduuid FK → pages

uploads

Metadata for Supabase Storage objects.

ColumnTypeNotes
iduuid PK
workspace_iduuid FK → workspaces
buckettext
object_keytextStorage path.
mime_typetext
size_bytesbigint
uploaded_byuuid FK → auth.users
uploaded_attimestamptz

search_index

Materialized tsvector + trigram fallback covering every block's text content.

Relationships at a glance

workspaces
 └─ spaces
     ├─ space_members
     └─ pages
         ├─ blocks (tree via parent_block_id)
         ├─ page_versions
         ├─ comments ─ comment_anchors ─ blocks
         ├─ share_links ─ share_link_visits
         ├─ page_tags ─ tags (optional: tag_groups)
         └─ page_links (graph)
uploads (workspace-scoped, referenced by block `data`)

RLS summary

  • spaces: visible if space_members row exists, or if visibility = workspace and the user is a workspace member, or if visibility = public.
  • pages: inherits from space + per-page override tables (not shown here for brevity; see the SQL).
  • blocks, page_versions, comments, comment_anchors: visible if the parent page is visible.
  • share_links, share_link_visits: readable by the link's creator and admins.
  • uploads: readable if the referencing page is readable.
  • Edge Functions use the service-role client for version pruning and publish rendering.