Fix import * statement in main.py
- Move wildcard import from app.db.all_models to module level - Fix SyntaxError that was preventing application startup - Ensure all models are registered with SQLAlchemy Base
This commit is contained in:
parent
53566813bd
commit
cc15df67ee
5
main.py
5
main.py
@ -6,6 +6,9 @@ from fastapi.openapi.utils import get_openapi
|
|||||||
|
|
||||||
from app.api.api_v1.api import api_router
|
from app.api.api_v1.api import api_router
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
|
|
||||||
|
# Import all models to ensure they are registered with Base
|
||||||
|
from app.db.all_models import * # noqa
|
||||||
from app.db.base import Base
|
from app.db.base import Base
|
||||||
from app.db.session import engine
|
from app.db.session import engine
|
||||||
|
|
||||||
@ -17,8 +20,6 @@ logger = logging.getLogger(__name__)
|
|||||||
def create_tables():
|
def create_tables():
|
||||||
try:
|
try:
|
||||||
logger.info("Creating database tables")
|
logger.info("Creating database tables")
|
||||||
# Import all models to ensure they are registered with Base
|
|
||||||
from app.db.all_models import * # noqa
|
|
||||||
Base.metadata.create_all(bind=engine)
|
Base.metadata.create_all(bind=engine)
|
||||||
logger.info("Database tables created successfully")
|
logger.info("Database tables created successfully")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user