From 36c0e25aeacddc8ce9e96750186b8fdf403b76c6 Mon Sep 17 00:00:00 2001 From: Jason Staack Date: Sun, 22 Mar 2026 08:11:03 -0500 Subject: [PATCH] fix(model): remove ORM FK for snmp_profile_id to avoid NoReferencedTableError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- backend/app/models/device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/models/device.py b/backend/app/models/device.py index cc5f06b..8c77ed8 100644 --- a/backend/app/models/device.py +++ b/backend/app/models/device.py @@ -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, )