Fix database migration error by adding missing dependency

- Added pydantic-settings>=2.0.0 to requirements.txt to resolve ModuleNotFoundError
- Simplified migrations/env.py imports to avoid config dependency issues
- Removed unnecessary settings import from migration environment
- Migration now uses database URL directly from alembic.ini configuration
This commit is contained in:
Automated Action 2025-06-17 05:55:17 +00:00
parent 091c42482c
commit 7cef391c68
3 changed files with 6 additions and 5 deletions

View File

@ -34,9 +34,7 @@ class CRUDTodo:
if completed is not None:
filters.append(Todo.completed == completed)
if overdue_only:
filters.append(
and_(Todo.due_date < datetime.now(), not_(Todo.completed))
)
filters.append(and_(Todo.due_date < datetime.now(), not_(Todo.completed)))
if filters:
query = query.filter(and_(*filters))

View File

@ -7,11 +7,13 @@ from sqlalchemy import engine_from_config, pool
from alembic import context
# Add the project root directory to the Python path
sys.path.append(str(Path(__file__).resolve().parent.parent))
project_root = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(project_root))
# Import Base from app.db.base
from app.db.base_model import Base # noqa
from app.core.config import settings # noqa
# No need to import settings since we use alembic.ini database URL
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.

View File

@ -3,6 +3,7 @@ uvicorn>=0.23.2
sqlalchemy>=2.0.0
pydantic>=2.4.2
pydantic[email]>=2.4.2
pydantic-settings>=2.0.0
alembic>=1.12.0
python-dotenv>=1.0.0
ruff>=0.1.3