-- 000045_tenant_quotas.sql — 租户(部门)级配额:Key 数量上限与月 Token 上限,
-- 0 = 不限。平台管理员多租户管理的基础:每个部门即一个租户,配额在创建时强制。

ALTER TABLE gateway.departments
    ADD COLUMN IF NOT EXISTS max_api_keys integer NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS max_monthly_tokens bigint NOT NULL DEFAULT 0;

COMMENT ON COLUMN gateway.departments.max_api_keys IS
    'Maximum gateway API keys bound to this tenant (department), 0 = unlimited.';
COMMENT ON COLUMN gateway.departments.max_monthly_tokens IS
    'Maximum monthly token usage for this tenant, 0 = unlimited.';
