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:
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7
-1
@@ -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()
|
||||
|
||||
@@ -93,9 +93,6 @@ class InvestorTable(Base, TimestampMixin):
|
||||
|
||||
# Geographic focus (deprecated in favor of fund-level, but keeping for backward compatibility)
|
||||
geographic_focus = Column(String, nullable=True)
|
||||
stage_focus = Column(
|
||||
Enum(InvestmentStage), nullable=True
|
||||
) # Deprecated in favor of fund-level
|
||||
|
||||
# Investment thesis and portfolio
|
||||
investment_thesis = Column(JSON, nullable=True) # Array of thesis statements
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -258,10 +258,6 @@ class InvestorSchema(BaseModel):
|
||||
default=None,
|
||||
description="Geographic investment focus. Do not return any special characters, Just locations separated by commas. Leave empty if not clearly identifiable.",
|
||||
)
|
||||
stage_focus: InvestmentStage = Field(
|
||||
default=InvestmentStage.SEED,
|
||||
description="Investment stage focus. Use SEED as default if uncertain.",
|
||||
)
|
||||
number_of_investments: Optional[int] = Field(
|
||||
default=None,
|
||||
ge=0,
|
||||
|
||||
Binary file not shown.
@@ -320,7 +320,6 @@ Return only the USD integer amount with current exchange rates."""
|
||||
check_size_lower=investor_data.investor.check_size_lower,
|
||||
check_size_upper=investor_data.investor.check_size_upper,
|
||||
geographic_focus=investor_data.investor.geographic_focus,
|
||||
stage_focus=investor_data.investor.stage_focus,
|
||||
number_of_investments=investor_data.investor.number_of_investments,
|
||||
)
|
||||
db.add(investor)
|
||||
|
||||
Reference in New Issue
Block a user