| 12345678910111213141516171819202122232425262728293031 |
- -- 010_tenants_fields.up.sql
- -- M13b W1: Tenant (company) operational fields.
- --
- -- Adds the per-tenant knobs the admin UI needs to manage:
- --
- -- rate_limit_per_sec INTEGER
- -- Cap on ingest events/sec for this tenant. Default 10000 (the
- -- value used in v1 everywhere). Enforced by the ingestion
- -- pipeline per-tenant (the per-tenant key is a known pattern;
- -- the existing M1/M4 ingest uses company_id from the event).
- --
- -- fcm_shared BOOLEAN
- -- When true, this tenant's FCM traffic uses the shared HTTP/2
- -- pool (the default in M8+). When false, future code can pin
- -- this tenant to a dedicated sender ID. Read by deliverd-fcm
- -- when picking a sender. W1 only persists the flag; the
- -- read-side is wired in M13b W3 (Telegram) where the same
- -- multi-tenant pool isolation story lives.
- --
- -- The migration is safe to apply to a populated DB — both columns
- -- have defaults that match what M13a W1-W5 code already expected
- -- (no behavior change for existing rows).
- SET search_path TO auth, public;
- ALTER TABLE auth.tenants
- ADD COLUMN IF NOT EXISTS rate_limit_per_sec INTEGER NOT NULL DEFAULT 10000
- CHECK (rate_limit_per_sec > 0 AND rate_limit_per_sec <= 1000000);
- ALTER TABLE auth.tenants
- ADD COLUMN IF NOT EXISTS fcm_shared BOOLEAN NOT NULL DEFAULT TRUE;
|