Skip to content

Commit 1d30172

Browse files
ebretontiangolo
authored andcommitted
🗃️ Fix SQLAlchemy class lookup (#29)
1 parent 6fc9a37 commit 1d30172

File tree

1 file changed

+5
-0
lines changed
  • {{cookiecutter.project_slug}}/backend/app/app/db

1 file changed

+5
-0
lines changed

{{cookiecutter.project_slug}}/backend/app/app/db/init_db.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
from app.core import config
33
from app.models.user import UserCreate
44

5+
# make sure all SQL Alchemy models are imported before initializing DB
6+
# otherwise, SQL Alchemy might fail to initialize properly relationships
7+
# for more details: https://github.com/tiangolo/full-stack-fastapi-postgresql/issues/28
8+
from app.db import base
9+
510

611
def init_db(db_session):
712
# Tables should be created with Alembic migrations

0 commit comments

Comments
 (0)