fix(analytics): 命中表索引幂等守卫独立+created_at 去掉 onupdate 语义
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -838,7 +838,11 @@ class SensitiveWord(Base):
|
||||
exclude_words: Mapped[list[Any] | dict[str, Any] | None] = mapped_column(
|
||||
JSON, nullable=True
|
||||
)
|
||||
created_at: Mapped[dt.datetime] = _updated_at()
|
||||
# created_at 不用 _updated_at():无 onupdate,首次落库后不被静默重写
|
||||
# (T8 改词/T10 处置命中只该动 updated_at/disposition)
|
||||
created_at: Mapped[dt.datetime] = mapped_column(
|
||||
sa.DateTime, nullable=False, server_default=sa.func.now()
|
||||
)
|
||||
updated_at: Mapped[dt.datetime] = _updated_at()
|
||||
|
||||
|
||||
@@ -866,7 +870,11 @@ class SensitiveHit(Base):
|
||||
disposition: Mapped[str] = mapped_column(
|
||||
String(16), nullable=False, default="pending", server_default="pending"
|
||||
)
|
||||
created_at: Mapped[dt.datetime] = _updated_at()
|
||||
# created_at 不用 _updated_at():无 onupdate,首次落库后不被静默重写
|
||||
# (T8 改词/T10 处置命中只该动 updated_at/disposition)
|
||||
created_at: Mapped[dt.datetime] = mapped_column(
|
||||
sa.DateTime, nullable=False, server_default=sa.func.now()
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
sa.UniqueConstraint("word_id", "msg_id", name="uq_sensitive_hit_word_msg"),
|
||||
|
||||
Reference in New Issue
Block a user