Files
matsewe df2d8f33a5
All checks were successful
release-tag / release-image (push) Successful in 42s
include time restriction
2025-05-26 10:48:10 +02:00

21 lines
798 B
Python

from sqlmodel import Session, create_engine
from app.core.config import settings
from app.models import Registration, RegistrationCreate
engine = create_engine(str(settings.SQLALCHEMY_DATABASE_URI))
# make sure all SQLModel models are imported (app.models) before initializing DB
# otherwise, SQLModel might fail to initialize relationships properly
# for more details: https://github.com/fastapi/full-stack-fastapi-template/issues/28
def init_db(session: Session) -> None:
# Tables should be created with Alembic migrations
# But if you don't want to use migrations, create
# the tables un-commenting the next lines
from sqlmodel import SQLModel
# This works because the models are already imported and registered from app.models
SQLModel.metadata.create_all(engine)