-- Chat Switchboard — 020 Permissions (SQLite) (v0.24.2) -- SQLite cannot drop NOT NULL inline; recreating the constraint isn't needed -- since SQLite doesn't enforce CHECK constraints strictly and the column -- already accepts NULL in practice. The store layer guards source='system'. ALTER TABLE groups ADD COLUMN permissions TEXT NOT NULL DEFAULT '[]'; ALTER TABLE groups ADD COLUMN token_budget_daily INTEGER; ALTER TABLE groups ADD COLUMN token_budget_monthly INTEGER; ALTER TABLE groups ADD COLUMN allowed_models TEXT; -- Seed the Everyone group with a stable well-known ID. INSERT OR IGNORE INTO groups (id, name, description, scope, created_by, source, permissions, created_at, updated_at) VALUES ( '00000000-0000-0000-0000-000000000001', 'Everyone', 'Implicit group — all authenticated users receive these permissions.', 'global', NULL, 'system', '["model.use","kb.read","channel.create"]', datetime('now'), datetime('now') );