Remove deprecated stage_focus column and update database path for consistency; add schema verification script and document schema mismatch fixes

This commit is contained in:
bolade
2025-10-07 11:31:16 +01:00
parent cd7172ed9f
commit 1f3f08e80d
20 changed files with 301 additions and 795 deletions
+7 -1
View File
@@ -1,4 +1,5 @@
import os
from pathlib import Path
from typing import Annotated
from fastapi import Depends
@@ -9,7 +10,11 @@ from sqlalchemy.orm import Session, sessionmaker
Base = declarative_base()
# Database configuration
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./investors.db")
# Use the preprocessor's database for consistency
# Get absolute path to the preprocessor database
APP_DIR = Path(__file__).parent.parent
PREPROCESSOR_DB = APP_DIR.parent / "preprocessor" / "version_two.db"
DATABASE_URL = os.getenv("DATABASE_URL", f"sqlite:///{PREPROCESSOR_DB}")
# Create engine
engine = create_engine(DATABASE_URL, echo=False)
@@ -38,6 +43,7 @@ def get_session_sync() -> Session:
"""Get a database session for synchronous operations"""
return SessionLocal()
def get_db_session():
"""Get a database session for direct use."""
return SessionLocal()