Fix database migration error

- Added missing pydantic-settings to requirements.txt
- Fixed database path inconsistency between config.py and session.py
- Updated alembic.ini to use proper SQLite URL format
- Updated migrations/env.py to use config settings

🤖 Generated with BackendIM... (backend.im)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Automated Action 2025-05-12 17:05:16 +00:00
parent 3de02dddff
commit 908da9e9de
4 changed files with 7 additions and 2 deletions

View File

@ -35,7 +35,7 @@ script_location = migrations
# are written from script.py.mako
# output_encoding = utf-8
sqlalchemy.url = sqlite:///projects/userauthenticationflowservice-fvu111/storage/db/db.sqlite
sqlalchemy.url = sqlite:////projects/userauthenticationflowservice-fvu111/storage/db/db.sqlite
[post_write_hooks]

View File

@ -30,7 +30,7 @@ class Settings(BaseSettings):
DEBUG: bool = True
# Database settings
DB_PATH: str = "/app/storage/db/db.sqlite"
DB_PATH: str = "/projects/userauthenticationflowservice-fvu111/storage/db/db.sqlite"
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_PATH}"
# First superuser

View File

@ -9,6 +9,7 @@ from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
from app.core.config import settings
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@ -25,6 +26,9 @@ from app.models.user import User # Import all models here for Alembic to detect
target_metadata = Base.metadata
# Override the sqlalchemy.url with the one from settings
config.set_main_option("sqlalchemy.url", settings.SQLALCHEMY_DATABASE_URL)
# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")

View File

@ -1,6 +1,7 @@
fastapi==0.104.1
uvicorn==0.23.2
pydantic==2.4.2
pydantic-settings==2.0.3
sqlalchemy==2.0.22
passlib==1.7.4
python-jose==3.3.0