Skip to main content

max / multithreaded

686 B · 17 lines History Blame Raw
1 -- Phase 14: Immutable posts + footnotes
2 -- Posts become permanent records. Corrections via author footnotes.
3 -- Mod removal preserves content in DB for audit.
4
5 CREATE TABLE post_footnotes (
6 id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
7 post_id UUID NOT NULL REFERENCES posts(id) ON DELETE CASCADE,
8 author_id UUID NOT NULL REFERENCES users(mnw_account_id),
9 body_markdown TEXT NOT NULL,
10 body_html TEXT NOT NULL,
11 created_at TIMESTAMPTZ NOT NULL DEFAULT now()
12 );
13 CREATE INDEX idx_post_footnotes_post_id ON post_footnotes(post_id);
14
15 ALTER TABLE posts ADD COLUMN removed_by UUID REFERENCES users(mnw_account_id);
16 ALTER TABLE posts ADD COLUMN removed_at TIMESTAMPTZ;
17