Skip to content
41 linesCodeBlameRaw
1-- People and teams (src/people.rs, src/teams.rs; crates/contracts/src/people.rs):
2-- a member's place in the workspace (a title, who they report to, what
3-- they own), and what a team has besides its people: agents, a lead, a
4-- channel and a monthly budget for its agents.
5--
6-- Wrangler applies it once; each ALTER must run once, like 0031's.
7
8-- A member's job title here ("Staff Engineer"), shown in the directory.
9ALTER TABLE workspace_members ADD COLUMN title TEXT;
10-- Who they report to: another member's user id. Cleared when either
11-- leaves the workspace. Never a cycle (people.rs checks).
12ALTER TABLE workspace_members ADD COLUMN manager_id TEXT;
13-- What they own, as a JSON array of a few short phrases
14-- (["storefront", "the release process"]). Agents on their teams are
15-- told it, to know who to ask.
16ALTER TABLE workspace_members ADD COLUMN owns TEXT;
17CREATE INDEX IF NOT EXISTS workspace_members_manager ON workspace_members (workspace_id, manager_id);
18
19-- Who leads a team: 'user' (a user id) or 'agent' (an agent id from the
20-- agents service), always one on the team. NULL for no lead.
21ALTER TABLE teams ADD COLUMN lead_kind TEXT;
22ALTER TABLE teams ADD COLUMN lead_id TEXT;
23-- The team's chat channel: its id in the chat service, and its name when
24-- it was chosen, for a link while chat is not asked.
25ALTER TABLE teams ADD COLUMN channel_id TEXT;
26ALTER TABLE teams ADD COLUMN channel_name TEXT;
27-- What the team's agents may spend together in a calendar month, in
28-- millionths of a dollar. NULL for no team budget; each agent keeps its own.
29ALTER TABLE teams ADD COLUMN budget_micros INTEGER;
30
31-- The agents on a team, by their id in the agents service. An agent is
32-- also on the team its own profile names (its home team), without a row.
33CREATE TABLE IF NOT EXISTS team_agents (
34 team_id TEXT NOT NULL,
35 agent_id TEXT NOT NULL,
36 -- The person who added it, by user id.
37 added_by TEXT,
38 created_at TEXT NOT NULL,
39 PRIMARY KEY (team_id, agent_id)
40);
41CREATE INDEX IF NOT EXISTS team_agents_agent ON team_agents (agent_id);