L10b Betrieb & Aufräumen: Migrationen clientId je Mandant und KI-Token-Kontingent

- 20260915090000_betrieb_client_id_per_tenant (Aufräumpunkt f, L8 offener Punkt 6): globale
  Unique-Indizes auf client_id (material_usages, work_sessions, time_entries, activity_notes,
  photos, voice_notes, reports, signatures) → @@unique([tenantId, clientId]). Offline-IDs sind nur
  je Mandant eindeutig; ein Replay derselben ID in einem anderen Mandanten scheiterte bisher mit
  internem Fehler. Keine neuen Tabellen.
- 20260915091000_betrieb_ai_token_limit (Aufräumpunkt k): tenant_settings.ai_monthly_token_limit
  (NULL = Plattform-Vorgabe AI_MONTHLY_TOKEN_LIMIT, 0 = unbegrenzt). Keine neue Tabelle.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 18:19:19 +02:00
co-authored by Claude Opus 5
parent 49f05c8db3
commit 5f08df324f
3 changed files with 78 additions and 8 deletions
@@ -0,0 +1,7 @@
-- L10b Betrieb & Aufräumen (Aufräumpunkt k, Spec §31 Kostenlimit):
-- Optional monthly AI token budget (input + output tokens of AiGeneration) per tenant.
-- NULL = platform default from env AI_MONTHLY_TOKEN_LIMIT, 0 = unlimited.
-- tenant_settings is already tenant-bound (RLS, TENANT_MODELS) — no new table.
-- AlterTable
ALTER TABLE "tenant_settings" ADD COLUMN "ai_monthly_token_limit" INTEGER;