-- Version 26 to 27: invariants, the rules that must hold in any work on their project. A table of
-- their keys, rebuilt with the rule index, and a record of each time they were given out. Nothing
-- else changes.
-- Run on its own, with nothing else holding the archive:
-- sqlite3 ~/.ctx/ctx.sqlite < schema/migrate/27-up.sql (or: ctx does this itself when it opens the archive)
BEGIN IMMEDIATE;
-- The rules from ctx remember whose technote says `kind: invariant`.
CREATE TABLE IF NOT EXISTS ctx_invariant(
key TEXT PRIMARY KEY
) STRICT, WITHOUT ROWID;
-- Each time ctx gave a project's invariants to someone; kept 30 days.
CREATE TABLE IF NOT EXISTS ctx_invariant_served(
at TEXT NOT NULL,
via TEXT NOT NULL,
project TEXT NOT NULL,
session TEXT NOT NULL,
n INTEGER NOT NULL,
us INTEGER NOT NULL
) STRICT;
PRAGMA user_version = 27;
COMMIT;