atproto Thingiverse but good
1.0 kB
24 lines
1-- PM-43: server-side, non-public publish drafts.
2--
3-- A draft is an in-progress publish composition that never reaches the actor's
4-- PDS until publish. It is stored as a `DraftThingInput`-shaped JSON payload (a
5-- ThingInput mirror with every field optional, so partial drafts round-trip).
6-- Drafts are app-internal (not ATProto records, not federated) and are strictly
7-- owner-scoped by DID. They live in their own table, so feeds — which read only
8-- the `things` table — never surface them.
9--
10-- `name` and `model_count` are denormalized copies refreshed on every upsert so
11-- `listDrafts` can render entries without parsing each payload.
12CREATE TABLE drafts (
13 owner_did TEXT NOT NULL,
14 draft_id TEXT NOT NULL,
15 payload_json TEXT NOT NULL,
16 name TEXT,
17 model_count INTEGER NOT NULL DEFAULT 0,
18 created_at INTEGER NOT NULL,
19 updated_at INTEGER NOT NULL,
20 PRIMARY KEY (owner_did, draft_id)
21);
22
23CREATE INDEX idx_drafts_owner_updated
24 ON drafts(owner_did, updated_at DESC);