diff --git a/app/database.py b/app/database.py index 0c0c2b2..5bf6aac 100644 --- a/app/database.py +++ b/app/database.py @@ -10,7 +10,6 @@ engine = create_engine(SQLALCHEMY_DATABASE_URL) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) Base = declarative_base() -Base.metadata.create_all(bind=engine) def get_db(): diff --git a/app/main.py b/app/main.py index cdf923f..428dfcb 100644 --- a/app/main.py +++ b/app/main.py @@ -2,6 +2,7 @@ from . import auth from .routers import post, user, vote from fastapi.middleware.cors import CORSMiddleware +from database import Base, engine # Auto generate database @@ -21,6 +22,9 @@ ) +Base.metadata.create_all(bind=engine) + + app.include_router(auth.router) app.include_router(post.router) app.include_router(user.router)