fix(model): remove ORM FK for snmp_profile_id to avoid NoReferencedTableError
SQLAlchemy couldn't resolve ForeignKey("snmp_profiles.id") because
there's no SNMPProfile ORM model — profiles are managed via raw SQL.
The FK constraint exists at the DB level via migration 039. The ORM
column is now a plain UUID.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -99,9 +99,9 @@ class Device(Base):
|
||||
)
|
||||
snmp_port: Mapped[int | None] = mapped_column(Integer, default=161, nullable=True)
|
||||
snmp_version: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
# FK enforced at DB level by migration 039; no ORM model for snmp_profiles
|
||||
snmp_profile_id: Mapped[uuid.UUID | None] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("snmp_profiles.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user