-- The immutable job payload binds the exact log source and target. NULL on a -- QueryLogs job means no grant-time classification exists (including history). ALTER TABLE jobs ADD COLUMN log_sensitive boolean; GRANT UPDATE(log_sensitive) ON jobs TO rmm_app; ALTER TABLE mcp_tokens DROP CONSTRAINT mcp_tokens_scopes_check; ALTER TABLE mcp_tokens ADD CONSTRAINT mcp_tokens_scopes_check CHECK ( cardinality(scopes) BETWEEN 1 AND 12 AND scopes <@ ARRAY[ 'inventory:read','logs:read','logs:read_sensitive','operations:read','operations:plan', 'operations:submit','jobs:cancel','scripts:execute','system:execute','root:execute', 'updates:apply','catalog:write']::text[] );