Skip to content
context Artifact [169e83a57e]
Login

Artifact [169e83a57e]

Artifact 169e83a57e43d5313c6edf9375a68d18b41a84849d79c92240c1c3fae723f3a3:


-- Version 25 to 26: a table of the sessions watching a ticket, for ctx ticket watch. Nothing else
-- changes.
-- Run on its own, with nothing else holding the archive:
--   sqlite3 ~/.ctx/ctx.sqlite < schema/migrate/26-up.sql   (or: ctx does this itself when it opens the archive)

BEGIN IMMEDIATE;
-- Sessions waiting on a ticket someone else works. Once the ticket is Done or Dropped, the
-- session's next ctx hook post tells it once, with the ticket's own result or reason.
CREATE TABLE IF NOT EXISTS ctx_ticket_watch(
  ticket       TEXT NOT NULL,       -- the full ticket uuid
  session      TEXT NOT NULL,
  at           TEXT NOT NULL,
  done_at      TEXT,
  delivered_at TEXT,
  PRIMARY KEY (ticket, session)
) STRICT, WITHOUT ROWID;
CREATE INDEX IF NOT EXISTS ctx_ticket_watch_waiting ON ctx_ticket_watch(session) WHERE delivered_at IS NULL;

PRAGMA user_version = 26;
COMMIT;