docs(brain): update second brain with postgres multi-tenancy ADR

This commit is contained in:
DanielS
2026-08-19 00:04:50 +02:00
parent 6a2ebd25a2
commit 0ef67e13a2
3 changed files with 34 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
# ADR 001: PostgreSQL 16 Hybrid Multi-Tenant Architektur
## Status
Akzeptiert
## Kontext
Gastro-SaaS Tischreservierung benötigt strenge Mandantentrennung bei hoher Performance.
## Entscheidung
- Nutzung von PostgreSQL 16 Schema-basierter Multi-Tenancy.
- Master-Schema (`public` / `tenants` Tabelle) für Mandantenverwaltung.
- Eigene Schemas pro Tenant (`tenant_<id>`) für operative Daten (`reservations`, `restaurant_tables`, `guests`).
- Spring Boot 3 `SchemaBasedMultiTenantConnectionProvider` & `CurrentTenantIdentifierResolver`.
## Konsequenzen
- Hohe Datenisolation & einfache Backups pro Tenant.
- Migrationen laufen schemaweise über Flyway.

View File

@@ -1,5 +1,7 @@
# Second Brain Wiki # Second Brain Wiki
- [Supabase Schema](file:///c:/source/webshop/.brain/supabase-schema.md) - [PostgreSQL Hybrid Multi-Tenant Setup](file:///c:/source/SmartSeat/SmartSeat/.brain/postgres-multi-tenant.md)
- [ADR Log](file:///c:/source/webshop/.brain/adr-log.md) - [ADR Log](file:///c:/source/SmartSeat/SmartSeat/.brain/adr-log.md)
- [LicServer API Spezifikation](file:///c:/source/webshop/.brain/licserver-api.md) - [Supabase Schema](file:///c:/source/SmartSeat/SmartSeat/.brain/supabase-schema.md)
- [LicServer API Spezifikation](file:///c:/source/SmartSeat/SmartSeat/.brain/licserver-api.md)

View File

@@ -0,0 +1,12 @@
# PostgreSQL 16 Hybrid Multi-Tenant Setup
## Architektur Overview
- **Docker Setup**: PostgreSQL 16 Alpine via Docker Compose.
- **Rollen-Isolation**: `app_user` (DML) & `migration_user` (DDL).
- **Master Schema**: `tenants` Tabelle in `V1__init_master_schema.sql`.
- **Tenant Schemas**: `dining_areas`, `restaurant_tables`, `guests`, `reservations`, `reservation_table_assignments`, `staff_users` in `V1__init_tenant_schema.sql`.
## Backend Integration
- `TenantContext` (ThreadLocal Schema Resolver)
- `SchemaBasedMultiTenantConnectionProvider` (Hibernate Connection Handling)
- HikariCP Connection Pool optimiert für Postgres in `application.yml`.