From 1d30172e7a76e3b78d2cdcb5289a3c986aa71264 Mon Sep 17 00:00:00 2001 From: Manu Date: Wed, 22 May 2019 13:29:24 +0200 Subject: [PATCH] :card_file_box: Fix SQLAlchemy class lookup (#29) --- {{cookiecutter.project_slug}}/backend/app/app/db/init_db.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/{{cookiecutter.project_slug}}/backend/app/app/db/init_db.py b/{{cookiecutter.project_slug}}/backend/app/app/db/init_db.py index 4f1d6f5..6374273 100644 --- a/{{cookiecutter.project_slug}}/backend/app/app/db/init_db.py +++ b/{{cookiecutter.project_slug}}/backend/app/app/db/init_db.py @@ -2,6 +2,11 @@ from app import crud from app.core import config from app.models.user import UserCreate +# make sure all SQL Alchemy models are imported before initializing DB +# otherwise, SQL Alchemy might fail to initialize properly relationships +# for more details: https://github.com/tiangolo/full-stack-fastapi-postgresql/issues/28 +from app.db import base + def init_db(db_session): # Tables should be created with Alembic migrations