steid

@jamesgill /

steid/migrations/20260906120201_create_issue_comments.sql
SQL737 BCode·Blame·History·Raw
1-- Comments on an issue.
2--
3-- Part of the issue aggregate: nothing addresses a comment except through the issue it
4-- hangs off, so there is no natural key beyond its id and `on delete cascade` is the
5-- whole of its lifecycle. Deleting an issue takes its conversation with it.
6--
7-- Ordered oldest first when read — a conversation reads forwards — so the index is
8-- ascending, unlike the issue list's.
9create table issue_comments (
10 id text primary key,
11 issue_id text not null references issues (id) on delete cascade,
12 author_id text not null references users (id),
13 body text not null,
14 created_at integer not null
15);
16
17create index issue_comments_issue on issue_comments (issue_id, created_at);