-- Version 24 to 25: covering indexes for project-scoped FTS5 search (ctx_chunk_meta) and
-- account-label lookup in rules-offer/usage (ctx_usage_account). Nothing else changes.
-- Run on its own, with nothing else holding the archive:
-- sqlite3 ~/.ctx/ctx.sqlite < schema/migrate/25-up.sql (or: ctx does this itself when it opens the archive)
BEGIN IMMEDIATE;
CREATE INDEX IF NOT EXISTS ctx_chunk_meta ON ctx_chunk(id, project, doc_id);
CREATE INDEX IF NOT EXISTS ctx_usage_account ON ctx_usage(account, plan, at) WHERE account IS NOT NULL;
PRAGMA user_version = 25;
COMMIT;