-- PM-43: server-side, non-public publish drafts. -- -- A draft is an in-progress publish composition that never reaches the actor's -- PDS until publish. It is stored as a `DraftThingInput`-shaped JSON payload (a -- ThingInput mirror with every field optional, so partial drafts round-trip). -- Drafts are app-internal (not ATProto records, not federated) and are strictly -- owner-scoped by DID. They live in their own table, so feeds — which read only -- the `things` table — never surface them. -- -- `name` and `model_count` are denormalized copies refreshed on every upsert so -- `listDrafts` can render entries without parsing each payload. CREATE TABLE drafts ( owner_did TEXT NOT NULL, draft_id TEXT NOT NULL, payload_json TEXT NOT NULL, name TEXT, model_count INTEGER NOT NULL DEFAULT 0, created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL, PRIMARY KEY (owner_did, draft_id) ); CREATE INDEX idx_drafts_owner_updated ON drafts(owner_did, updated_at DESC);