docs: document automatic migrations system
All checks were successful
Deploy Development / deploy (push) Successful in 36s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s

Updated CLAUDE.md to reflect new database migrations system:
- Added backend/migrations/ to directory structure
- Added schema_migrations table to database schema
- Updated deployment section with migration workflow
- Added reference to .claude/docs/technical/MIGRATIONS.md

The migrations system automatically applies SQL files (XXX_*.sql pattern)
on container startup, with tracking in schema_migrations table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-21 10:12:28 +01:00
parent 913b485500
commit 49467ca6e9

View File

@ -21,9 +21,11 @@ Teil der **Jinkendo**-App-Familie (人拳道). Domains: jinkendo.de / .com / .li
backend/
├── main.py # App-Setup + Router-Registration (~75 Zeilen)
├── db.py # PostgreSQL Connection Pool
├── db_init.py # DB-Init + Migrations-System (automatisch beim Start)
├── auth.py # Hash, Verify, Sessions, Feature-Access-Control
├── models.py # Pydantic Models
├── feature_logger.py # Strukturiertes JSON-Logging (Phase 2)
├── migrations/ # SQL-Migrationen (XXX_*.sql Pattern)
└── routers/ # 14 Router-Module
auth · profiles · weight · circumference · caliper
activity · nutrition · photos · insights · prompts
@ -83,6 +85,7 @@ frontend/src/
### v9c Finalisierung ✅
- ✅ **Selbst-Registrierung:** POST /api/auth/register, E-Mail-Verifizierung, Auto-Login
- ✅ **Trial-System UI:** Countdown-Banner im Dashboard (3 Urgency-Level)
- ✅ **Migrations-System:** Automatische Schema-Migrationen beim Start (db_init.py)
### Offen v9d 🔲
- Schlaf-Modul
@ -121,6 +124,12 @@ Runner: Raspberry Pi (/home/lars/gitea-runner/)
Manuell:
cd /home/lars/docker/bodytrack[-dev]
docker compose -f docker-compose[.dev-env].yml build --no-cache && up -d
Migrations:
Werden automatisch beim Container-Start ausgeführt (db_init.py)
Nur nummerierte Dateien: backend/migrations/XXX_*.sql
Tracking in schema_migrations Tabelle
📚 Details: .claude/docs/technical/MIGRATIONS.md
```
## Datenbank-Schema (PostgreSQL 16)
@ -142,10 +151,14 @@ subscriptions · coupons · coupon_redemptions · features
tier_limits · user_feature_restrictions · user_feature_usage
access_grants · user_activity_log
Infrastruktur:
schema_migrations Tracking für automatische DB-Migrationen
Feature-Logging (Phase 2):
/app/logs/feature-usage.log # JSON-Format, alle Feature-Zugriffe
Schema-Datei: backend/schema.sql
Migrationen: backend/migrations/*.sql (automatisch beim Start)
```
## API & Auth
@ -233,6 +246,7 @@ Bottom-Padding Mobile: 80px (Navigation)
| Backend-Architektur, Router, DB-Zugriff | `.claude/docs/architecture/BACKEND.md` |
| Frontend-Architektur, api.js, Komponenten | `.claude/docs/architecture/FRONTEND.md` |
| **Feature-Enforcement (neue Features hinzufügen)** | `.claude/docs/architecture/FEATURE_ENFORCEMENT.md` |
| **Database Migrations (Schema-Änderungen)** | `.claude/docs/technical/MIGRATIONS.md` |
| Coding Rules (Pflichtregeln) | `.claude/docs/rules/CODING_RULES.md` |
| Lessons Learned (Fehler vermeiden) | `.claude/docs/rules/LESSONS_LEARNED.md` |
| Feature Backlog (Übersicht) | `.claude/docs/BACKLOG.md` |