mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10:46 +08:00
fix(netx): avoid alarm sync failures from long UME fields
Store UME alarm payload fields as TEXT and run startup ALTER COLUMN upgrades so large alarm records no longer fail with StringDataRightTruncation. Keep full values during sync while hashing only pathological ultra-long alarm keys to preserve idempotent primary keys. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b253ee7bff
commit
eebfbf25fa
3 changed files with 42 additions and 18 deletions
|
|
@ -166,15 +166,15 @@ class UmeInventoryNE(Base):
|
|||
class UmeAlarmCurrent(Base):
|
||||
__tablename__ = "ume_alarms_current"
|
||||
|
||||
alarm_key: Mapped[str] = mapped_column(String(256), primary_key=True)
|
||||
alarm_key: Mapped[str] = mapped_column(Text, primary_key=True)
|
||||
ne_id: Mapped[str] = mapped_column(String(128), default="", index=True)
|
||||
object_name: Mapped[str] = mapped_column(String(512), default="", index=True)
|
||||
event_type: Mapped[str] = mapped_column(String(128), default="")
|
||||
native_probable_cause: Mapped[str] = mapped_column(String(256), default="")
|
||||
perceived_severity: Mapped[str] = mapped_column(String(64), default="", index=True)
|
||||
is_cleared: Mapped[str] = mapped_column(String(16), default="", index=True)
|
||||
time_created: Mapped[str] = mapped_column(String(64), default="", index=True)
|
||||
root_cause_alarm_indication: Mapped[str] = mapped_column(String(32), default="")
|
||||
object_name: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
event_type: Mapped[str] = mapped_column(Text, default="")
|
||||
native_probable_cause: Mapped[str] = mapped_column(Text, default="")
|
||||
perceived_severity: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
is_cleared: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
time_created: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
root_cause_alarm_indication: Mapped[str] = mapped_column(Text, default="")
|
||||
first_seen_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
last_seen_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, index=True)
|
||||
raw_json: Mapped[str] = mapped_column(Text, default="{}")
|
||||
|
|
@ -183,15 +183,15 @@ class UmeAlarmCurrent(Base):
|
|||
class UmeAlarmHistory(Base):
|
||||
__tablename__ = "ume_alarms_history"
|
||||
|
||||
alarm_key: Mapped[str] = mapped_column(String(256), primary_key=True)
|
||||
alarm_key: Mapped[str] = mapped_column(Text, primary_key=True)
|
||||
ne_id: Mapped[str] = mapped_column(String(128), default="", index=True)
|
||||
object_name: Mapped[str] = mapped_column(String(512), default="", index=True)
|
||||
event_type: Mapped[str] = mapped_column(String(128), default="")
|
||||
native_probable_cause: Mapped[str] = mapped_column(String(256), default="")
|
||||
perceived_severity: Mapped[str] = mapped_column(String(64), default="", index=True)
|
||||
is_cleared: Mapped[str] = mapped_column(String(16), default="", index=True)
|
||||
time_created: Mapped[str] = mapped_column(String(64), default="", index=True)
|
||||
root_cause_alarm_indication: Mapped[str] = mapped_column(String(32), default="")
|
||||
object_name: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
event_type: Mapped[str] = mapped_column(Text, default="")
|
||||
native_probable_cause: Mapped[str] = mapped_column(Text, default="")
|
||||
perceived_severity: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
is_cleared: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
time_created: Mapped[str] = mapped_column(Text, default="", index=True)
|
||||
root_cause_alarm_indication: Mapped[str] = mapped_column(Text, default="")
|
||||
first_seen_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
last_seen_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, index=True)
|
||||
raw_json: Mapped[str] = mapped_column(Text, default="{}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue