Fix module import error in Alembic migrations

This commit is contained in:
Automated Action 2025-05-26 18:58:07 +00:00
parent 9e50f1fa57
commit dae2c93ef8

View File

@ -1,9 +1,16 @@
import os
import sys
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
# Add the project root directory to the Python path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from alembic import context
from sqlalchemy import engine_from_config, pool
# We need to import models so they're registered with SQLAlchemy
import app.models.todo # noqa
from app.db.database import Base
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@ -15,8 +22,6 @@ fileConfig(config.config_file_name)
# add your model's MetaData object here
# for 'autogenerate' support
from app.models.todo import Todo
from app.db.database import Base
target_metadata = Base.metadata
# other values from the config, defined by the needs of env.py,