feat: add Alembic database migrations
Replace create_all() startup approach with Alembic for proper schema versioning. Includes initial migration for users and evotor_connections tables, entrypoint script that runs migrations before starting uvicorn. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,6 @@ from fastapi.staticfiles import StaticFiles
|
||||
from starlette.middleware.sessions import SessionMiddleware
|
||||
|
||||
from web.config import settings
|
||||
from web.database import engine, Base
|
||||
from web.models import User, EvotorConnection # noqa: F401 — registers models with Base
|
||||
from web.routes import auth, profile, reset, evotor
|
||||
|
||||
app = FastAPI(title="EvoSync — Личный кабинет")
|
||||
@@ -16,8 +14,3 @@ app.include_router(auth.router)
|
||||
app.include_router(profile.router)
|
||||
app.include_router(reset.router)
|
||||
app.include_router(evotor.router)
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
def on_startup():
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
Reference in New Issue
Block a user