-- 005_ws.up.sql -- M5: WebSocket ingest + per-IP concurrency cap (SPEC §22 layer 2). -- See SPEC §22 milestone rollout — M5 ships layer 2 "obvious once -- WS is in". -- -- What lands in M5: -- sources.max_concurrent_connections — per-source override for -- the in-memory per-IP cap. Default 32 for -- WS, 64 for HTTP. The HTTP path's -- Server.ConnState callback increments / -- decrements the same counter, so the -- same column covers both transports. -- -- Why per-source and not per-IP: the SPEC §22 cap is per-IP, but -- the config knob is per-source because a single source might be -- a multi-tenant gateway (one source_id, many egress IPs). M5 -- keeps the per-IP default at the source's -- `max_concurrent_connections` value. M11 will replace this with -- a per-IP-and-per-source intersection in the in-memory map. -- -- What's NOT in M5 (and not supposed to be): -- Tail events persistence (M5 is live-only) -- Tail auth beyond the static token (M11, security milestone) -- Quarantine and circuit breaker (M9) -- Per-company tail subscription (M9) ALTER TABLE sources ADD COLUMN IF NOT EXISTS max_concurrent_connections INTEGER NOT NULL DEFAULT 32; -- Same column on companies for the global default (any -- per-company sources inherit this if their own is unset; M0 -- doesn't have a per-company override but the column is -- reserved for the M2 routing-rules upgrade). ALTER TABLE companies ADD COLUMN IF NOT EXISTS max_concurrent_connections INTEGER NOT NULL DEFAULT 64;