-- 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;