| 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. |
| 9 | ( |
| 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 | |
| 17 | (issue_id, created_at); |