refactor(db): rename search_space to workspace in satellite ORM models (Phase 2 Wave B)

Flip search_space_id -> workspace_id and the workspace relationship/back_populates
in the automations, file_storage, notifications, and podcasts persistence models,
and drop the Phase 1 Column("workspace_id", ...) shim. Full SQLAlchemy mapper
configuration now passes (db.py + satellites consistent).
This commit is contained in:
CREDO23 2026-06-26 18:20:28 +02:00
parent df03565940
commit d948b769ba
4 changed files with 7 additions and 11 deletions

View file

@ -24,8 +24,7 @@ from ..enums.automation_status import AutomationStatus
class Automation(BaseModel, TimestampMixin):
__tablename__ = "automations"
search_space_id = Column(
"workspace_id",
workspace_id = Column(
Integer,
ForeignKey("workspaces.id", ondelete="CASCADE"),
nullable=False,
@ -66,7 +65,7 @@ class Automation(BaseModel, TimestampMixin):
index=True,
)
search_space = relationship("SearchSpace", back_populates="automations")
workspace = relationship("Workspace", back_populates="automations")
created_by = relationship("User", back_populates="automations")
triggers = relationship(
"AutomationTrigger",

View file

@ -29,8 +29,7 @@ class DocumentFile(BaseModel, TimestampMixin):
nullable=False,
index=True,
)
search_space_id = Column(
"workspace_id",
workspace_id = Column(
Integer,
ForeignKey("workspaces.id", ondelete="CASCADE"),
nullable=False,

View file

@ -47,8 +47,7 @@ class Notification(BaseModel, TimestampMixin):
nullable=False,
index=True,
)
search_space_id = Column(
"workspace_id",
workspace_id = Column(
Integer,
ForeignKey("workspaces.id", ondelete="CASCADE"),
nullable=True,
@ -70,4 +69,4 @@ class Notification(BaseModel, TimestampMixin):
)
user = relationship("User", back_populates="notifications")
search_space = relationship("SearchSpace", back_populates="notifications")
workspace = relationship("Workspace", back_populates="notifications")

View file

@ -68,13 +68,12 @@ class Podcast(BaseModel, TimestampMixin):
# Legacy local audio path; retained for back-compat until cutover.
file_location = Column(Text, nullable=True)
search_space_id = Column(
"workspace_id",
workspace_id = Column(
Integer,
ForeignKey("workspaces.id", ondelete="CASCADE"),
nullable=False,
)
search_space = relationship("SearchSpace", back_populates="podcasts")
workspace = relationship("Workspace", back_populates="podcasts")
thread_id = Column(
Integer,