Skip to main content

Notebook

Versioned note_groups, notes, ProseMirror note_documents, and images.
2 min read

Source: 000006_notebook.up.sql, 000063_document_schema_version.up.sql.

Model#

note_groups#

ColumnNotes
profile_id / created_by
name / description / color
positionUI order
soft deletedeleted_at

notes#

Note metadata (not the full ProseMirror JSON).

ColumnTypeNotes
idUUID PK
profile_idUUID
author_idUUID → users
titleTEXTDefault ''
typeTEXTnote | blog | x_post | x_thread | report | research
statusTEXTdraft | review | ready | published
visibilityTEXTmembers | subscribers | followers | public. Default members. Public catalog only for blog / research / report + published.
group_idUUID → note_groupsNullable
date_keyTEXTOptional local day
migration_source_idTEXTLegacy migrations
plain_text / excerpt / search_blobTEXTDerived
word_count / character_countINTStats
pinned_at / archived_atTIMESTAMPTZArchive hides the note from the notebook's active list; detail and search can still show it.
created_at / updated_at / deleted_atSoft-delete: GET …/notes/trash + POST …/notes/:id/restore.

Indexes: profile+updated, group, GIN search on search_blob.

note_documents#

ColumnNotes
note_idCASCADE; unique active 1:1
profile_id
content_jsonJSONB ProseMirror document
schema_versionSMALLINT, default 1. Independent of editing version.
versionOptimistic lock
search_textServer-derived plain-text projection
created_by
soft delete

API uncached: GET/PUT …/notes/:id/document.

note_images#

ColumnNotes
note_idCASCADE
image_urlNOT NULL
blob fieldsurl, pathname, store, etag, content_type, size
created_by
soft delete

Who writes#

  • Go: internal/notebook
  • Front: features/notebook