Fix database migration error

- Added project root to Python path in env.py to make app module importable
- Updated database path in alembic.ini and session.py to match current environment

generated with BackendIM... (backend.im)
This commit is contained in:
Automated Action 2025-05-12 17:03:01 +00:00
parent 8575427c43
commit 3de02dddff
3 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:///app/storage/db/db.sqlite
sqlalchemy.url = sqlite:///projects/userauthenticationflowservice-fvu111/storage/db/db.sqlite
[post_write_hooks]

View File

@ -6,7 +6,7 @@ from sqlalchemy.orm import sessionmaker
from app.core.config import settings
# Ensure db directory exists
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR = Path("/projects/userauthenticationflowservice-fvu111") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL = f"sqlite:///{DB_DIR}/db.sqlite"

View File

@ -1,4 +1,9 @@
from logging.config import fileConfig
import os
import sys
# Add the project root directory to Python's path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sqlalchemy import engine_from_config
from sqlalchemy import pool