Skip to content
10 linesCodeBlameRaw
1-- The order the log wrote events in. Ids are made when an event is
2-- published, on whichever Worker published it, and events reach the log
3-- through a queue, so an event can be written after one with a later id.
4-- Following the log with an `after` cursor reads by this instead: what is
5-- written later always has a higher number, so a follower never skips one.
6-- Each insert takes the highest so far plus one; the log has one writer
7-- at a time. Events written before this have none and are not followed.
8ALTER TABLE events ADD COLUMN seq INTEGER;
9CREATE INDEX IF NOT EXISTS events_seq ON events (seq);
10CREATE INDEX IF NOT EXISTS events_repo_seq ON events (repo_id, seq);