Files
certain/backend/app/migrate.py
T
GuidoandClaude Opus 4.8 2c795a57c8 feat: Phase 0 – Gerüst (FastAPI+SQLite, Multi-User-Login, React-App-Shell, Deploy)
Grundgerüst für Certain Finance:
- Backend: FastAPI + SQLAlchemy + SQLite, Alembic-Migrationen (Batch-Mode),
  argon2-Passwort-Hashing, server-seitige Sitzungen im Cookie, Erst-Admin,
  Benutzerverwaltung mit Temporär-Passwort, Einstellungen je Benutzer.
- Ein Prozess, ein Port: uvicorn liefert API (/api) und gebautes SPA aus,
  inkl. SPA-Deeplink-Fallback.
- Frontend: React 18 + Vite + JSX, Design-Tokens (Light/Dark), i18n DE/EN,
  Inline-SVG-Icons (keine Emojis), Login, Passwort-ändern, Dashboard-Platzhalter,
  Benutzer- und Einstellungsseiten.
- Deploy: nativer LXC-Installer + Update-Skript (systemd), env-Vorlage, Doku.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-19 18:27:42 +02:00

26 lines
737 B
Python
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.
"""Programmatisches Anwenden der Alembic-Migrationen.
Wird beim App-Start aufgerufen, damit ein frisch geklontes/gestartetes System
sofort das aktuelle Schema hat – ohne dass man ``alembic`` von Hand ausführen muss.
Das Install-/Update-Skript ruft ``alembic upgrade head`` zusätzlich auf; das ist
idempotent.
"""
from pathlib import Path
from alembic import command
from alembic.config import Config
# backend/ (eine Ebene über app/)
BACKEND_DIR = Path(__file__).resolve().parent.parent
def _config() -> Config:
cfg = Config(str(BACKEND_DIR / "alembic.ini"))
cfg.set_main_option("script_location", str(BACKEND_DIR / "migrations"))
return cfg
def upgrade_to_head() -> None:
command.upgrade(_config(), "head")