steid

@jamesgill /

steid/migrations/20260906180101_create_pull_request_comments.sql
SQL801 BCode·Blame·History·Raw
1-- Comments on a pull request.
2--
3-- Part of the pull request aggregate, the way `issue_comments` is part of an issue:
4-- nothing addresses a comment except through the request it hangs off, so there is no
5-- natural key beyond its id and `on delete cascade` is the whole of its lifecycle.
6--
7-- Ordered oldest first when read — a conversation reads forwards — so the index is
8-- ascending, unlike the list's.
9create table pull_request_comments (
10 id text primary key,
11 pull_request_id text not null references pull_requests (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 pull_request_comments_pull on pull_request_comments (pull_request_id, created_at);