meldestelle/docs/05_Backend/Multi_Tenant_Kurz.md
StefanMoCoAt dbe7c74a9c Document tenant-aware database schema, multi-tenant strategy, and API references:
- Add database schema documentation: `Database_Schema_V1-V009.md` for tenant-isolated entities (`veranstaltungen`, `turniere`, `bewerbe`, etc.).
- Draft initial Kassa API reference: `Kassa_API.md` (status: DRAFT).
- Finalize Stammdaten API reference: `API_Uebersicht_Stammdaten.md` (status: ACTIVE).
- Summarize tenant isolation and multi-tenant strategy in `Multi_Tenant_Kurz.md`.
- Update `README.md` with links to new references. Mark B-2 roadmap tasks as partially complete.
2026-04-03 22:59:45 +02:00

29 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
type: Reference
status: ACTIVE
owner: Lead Architect
last_update: 2026-04-03
---
# Tenant-Isolation & MultiTenant (Kurzfassung)
Vollständige Entscheidung: [ADR0021: TenantResolutionStrategie (SchemaperTenant)](../01_Architecture/adr/0021-tenant-resolution-strategy-de.md).
## Kernaussagen
- Eine Veranstaltung = ein Tenant = ein Datenbankschema (SchemaperTenant).
- Requests tragen `X-Event-Id`; Backend validiert gegen `control.tenants` und schaltet das Schema je Request.
- Flyway führt Migrationen je TenantSchema aus (eigene `flyway_schema_history`).
- Stammdaten (Reiter/Pferde/Vereine/Funktionäre) sind global und nicht tenantspezifisch; Entries/Kassa sind tenantlokal.
## Umsetzung (Kurz)
- WebLayer: `TenantWebFilter` (Spring) bzw. Plugin (Ktor) liest `X-Event-Id` und legt `TenantContext` ab.
- Persistence: SCHEMAMultitenancy (`SET search_path`) oder Hibernate`MultiTenantConnectionProvider`.
- Registry: `control.tenants(event_id, schema_name, status, db_url?, version, created_at)`.
## Betroffene Bereiche
- Datenmodell tenantlokal: `veranstaltungen`, `turniere`, `bewerbe`, `abteilungen`, `teilnehmer_konten`, `turnier_kassa` (siehe [Datenbankschema](./Schema/Database_Schema_V1-V009.md)).
- Services: Der EntriesService arbeitet mandantenfähig; andere Services bleiben SingleTenant/global (vgl. BackendRoadmap).