-- Inbound webhook triggers (Triggered deploy mode): a token whose URL, when -- POSTed, fires the bound team's topology run. No FKs (app logic enforces the -- workspace/team relationship) so this migration is boot-safe. CREATE TABLE IF NOT EXISTS webhook_tokens ( id UUID PRIMARY KEY, workspace_id UUID NOT NULL, team_id UUID NOT NULL, token UUID NOT NULL UNIQUE, task TEXT NOT NULL DEFAULT '', last_fired_at TIMESTAMPTZ, created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE INDEX IF NOT EXISTS webhook_tokens_team_idx ON webhook_tokens (team_id);