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:
parent
091c42482c
commit
7cef391c68
@ -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))
|
||||
|
@ -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.
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user