feat(11-01): create sites table migration, model, and schemas
- Add migration 030 with sites table, RLS policy, and device site_id FK - Add Site SQLAlchemy model with tenant isolation - Add site_id nullable FK and relationship to Device model - Add sites relationship to Tenant model - Register Site in models __init__.py - Add SiteCreate, SiteUpdate, SiteResponse, SiteListResponse schemas Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,6 +52,9 @@ class Tenant(Base):
|
||||
device_tags: Mapped[list["DeviceTag"]] = relationship(
|
||||
"DeviceTag", back_populates="tenant", passive_deletes=True
|
||||
) # type: ignore[name-defined]
|
||||
sites: Mapped[list["Site"]] = relationship(
|
||||
"Site", back_populates="tenant", cascade="all, delete-orphan"
|
||||
) # type: ignore[name-defined]
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<Tenant id={self.id} name={self.name!r}>"
|
||||
|
||||
Reference in New Issue
Block a user