mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
feat: add connector_id to documents for source tracking and implement connector deletion task
This commit is contained in:
parent
b4ed15585e
commit
bf08982029
33 changed files with 572 additions and 13 deletions
|
|
@ -760,9 +760,18 @@ class Document(BaseModel, TimestampMixin):
|
|||
index=True,
|
||||
)
|
||||
|
||||
# Track which connector created this document (for cleanup on connector deletion)
|
||||
connector_id = Column(
|
||||
Integer,
|
||||
ForeignKey("search_source_connectors.id", ondelete="SET NULL"),
|
||||
nullable=True, # Nullable for manually uploaded docs without connector
|
||||
index=True,
|
||||
)
|
||||
|
||||
# Relationships
|
||||
search_space = relationship("SearchSpace", back_populates="documents")
|
||||
created_by = relationship("User", back_populates="documents")
|
||||
connector = relationship("SearchSourceConnector", back_populates="documents")
|
||||
chunks = relationship(
|
||||
"Chunk", back_populates="document", cascade="all, delete-orphan"
|
||||
)
|
||||
|
|
@ -991,6 +1000,9 @@ class SearchSourceConnector(BaseModel, TimestampMixin):
|
|||
UUID(as_uuid=True), ForeignKey("user.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
|
||||
# Documents created by this connector (for cleanup on connector deletion)
|
||||
documents = relationship("Document", back_populates="connector")
|
||||
|
||||
|
||||
class NewLLMConfig(BaseModel, TimestampMixin):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue