Files
maarcadetweet/migrations/appview/0003_embeds_and_threads.sql
tomdebone c586fd39c9 maarcadetweet: initial commit
AT Protocol PDS + AppView + Tauri Desktop Client, 160-char post limit.

- PDS (Rust + axum + sqlx)
  - Auth: createAccount, createSession, refreshSession
  - Records: createRecord, deleteRecord (race-safe via SELECT FOR UPDATE)
  - Feed: feed.like.create, feed.repost.create
  - Sync: getRepo, getBlocks, getLatestCommit, getRecord (with MST proof), listRepos
  - Identity: resolveHandle
  - MST: spec-conformant (at-mst crate, 27 tests)
  - Repo: signed commits, TID counter (monotonic, 4096 wrap safe)

- AppView (Rust + axum + sqlx)
  - Jetstream consumer (WebSocket, exponential backoff, 38k+ events indexed)
  - REST API: timeline/home (graph-aware), profile, search, post (with thread hydration)
  - Handle-sync worker (did:plc + did:web)
  - JSONB embed storage + thread columns (migration 0003)
  - Like/repost counter cache (migration 0004)

- Tauri 2 + Svelte 5 Desktop Client
  - System tray (Show/Compose/Quit menu)
  - OS notifications (tauri-plugin-notification)
  - Auto-update (tauri-plugin-updater, placeholder endpoint)
  - Window-state (tauri-plugin-window-state)
  - 160-char compose with live counter
  - Image/Link embed rendering
  - LocalStorage-persisted like state
  - Timeline with poll (prepend new posts)
  - Custom TitleBar (transparent, no decorations)
  - Orange/IBM Plex Mono maarcade design

Tests: 231 Rust + 9 vitest = 240 passed.
2026-07-05 20:01:31 +02:00

38 lines
2.0 KiB
SQL

-- AppView database migration 0003
-- Adds embed + thread-context columns to `posts`.
--
-- Why
--
-- Phase 4 (indexer) only stored `text` + `parent_uri` + `root_uri`, which
-- was enough to render plain-text timelines. Phase 5 wants embeds (images,
-- link cards, quoted posts) and thread context visible in the UI.
--
-- Columns
-- embed JSONB, nullable — the full AT-Protocol embed
-- object as it appears in the record value. We
-- store the whole thing verbatim rather than
-- normalising into a separate `embeds` table so
-- the UI can decode it without a second round
-- trip, and so a future lexicon change doesn't
-- require a schema migration.
-- reply_parent_handle TEXT, nullable — display handle for
-- `parent_uri`'s author. Backfilled by the
-- handle-sync worker. Nullable because the
-- sync worker hasn't seen the row yet, OR
-- because the parent isn't in our index.
-- reply_root_handle TEXT, nullable — display handle for
-- `root_uri`'s author. Same semantics.
-- reply_root_uri TEXT, nullable — duplicate of `root_uri`
-- for the "show full thread" link target.
-- Kept as its own column so the index covers
-- it without having to special-case NULLs on
-- the existing `root_uri`.
--
-- All columns are nullable. Pre-existing rows will continue to render
-- correctly — old posts simply have `embed = NULL` and the UI omits the
-- embed block.
ALTER TABLE posts ADD COLUMN IF NOT EXISTS embed JSONB;
ALTER TABLE posts ADD COLUMN IF NOT EXISTS reply_parent_handle TEXT;
ALTER TABLE posts ADD COLUMN IF NOT EXISTS reply_root_handle TEXT;
ALTER TABLE posts ADD COLUMN IF NOT EXISTS reply_root_uri TEXT;