CRITICAL FIX: Add missing SQLAlchemy relationships to SearchSpace class

- Added search_source_connectors relationship (back_populates from SearchSourceConnector)
- Added llm_configs relationship (back_populates from LLMConfig)
- Added user_preferences relationship (back_populates from UserSearchSpacePreference)
- Prevents SQLAlchemy InvalidRequestError on application startup
- Fixes broken ORM mappings that would crash the entire application

This resolves the critical issue where SQLAlchemy could not find the required
relationships, preventing the application from starting.
This commit is contained in:
Aditya Vaish 2025-10-16 10:21:28 +05:30
parent b07ce72f05
commit 2facfd7a8d

View file

@ -260,6 +260,24 @@ class SearchSpace(BaseModel, TimestampMixin):
order_by="ConnectorSchedule.id", order_by="ConnectorSchedule.id",
cascade="all, delete-orphan", cascade="all, delete-orphan",
) )
search_source_connectors = relationship(
"SearchSourceConnector",
back_populates="search_space",
order_by="SearchSourceConnector.id",
cascade="all, delete-orphan",
)
llm_configs = relationship(
"LLMConfig",
back_populates="search_space",
order_by="LLMConfig.id",
cascade="all, delete-orphan",
)
user_preferences = relationship(
"UserSearchSpacePreference",
back_populates="search_space",
order_by="UserSearchSpacePreference.id",
cascade="all, delete-orphan",
)
class SearchSourceConnector(BaseModel, TimestampMixin): class SearchSourceConnector(BaseModel, TimestampMixin):