From 111f510cf5b1d803d9c1e8e510218196302f137a Mon Sep 17 00:00:00 2001 From: Kris <2893855659@qq.com> Date: Thu, 9 Jul 2026 13:52:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(postgres=20models):=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=A4=9A=E4=B8=AA=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E9=95=BF=E5=BA=A6=E5=92=8C=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将ChannelContentReviewRecord的account_id从String(64)扩容至String(128),补充注释说明对齐channel_accounts.account_id 2. 将Conversation的uid从String(64)扩容至String(225),补充注释说明包含服务账号uid 3. 将Conversation的channel_account_id从String(64)扩容至String(128),补充对齐注释 4. 将MessageFeedback和AgentRun的uid从String(64)扩容至String(225),补充注释说明包含服务账号uid --- .../package/yuxi/storage/postgres/models_business.py | 10 ++++++---- .../package/yuxi/storage/postgres/models_channels.py | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/package/yuxi/storage/postgres/models_business.py b/backend/package/yuxi/storage/postgres/models_business.py index 179e4708..f1a5fde8 100644 --- a/backend/package/yuxi/storage/postgres/models_business.py +++ b/backend/package/yuxi/storage/postgres/models_business.py @@ -264,7 +264,7 @@ class Conversation(Base): id = Column(Integer, primary_key=True, autoincrement=True, comment="Primary key") thread_id = Column(String(64), unique=True, index=True, nullable=False, comment="Thread ID (UUID)") - uid = Column(String(64), index=True, nullable=False, comment="UID") + uid = Column(String(225), index=True, nullable=False, comment="UID(含服务账号 uid,最长 225 字符)") agent_id = Column(String(64), index=True, nullable=False, comment="Agent ID") title = Column(String(255), nullable=True, comment="Conversation title") status = Column(String(20), default="active", comment="Status: active/archived/deleted") @@ -283,7 +283,9 @@ class Conversation(Base): ) channel_session_id = Column(String(64), nullable=True, comment="关联渠道会话 ID(冗余,便于查询)") channel_type = Column(String(32), nullable=True, index=True, comment="来源渠道类型(FR-10)") - channel_account_id = Column(String(64), nullable=True, comment="来源渠道账户 ID(FR-10)") + channel_account_id = Column( + String(128), nullable=True, comment="来源渠道账户 ID(FR-10,对齐 channel_accounts.account_id)" + ) # Relationships messages = relationship("Message", back_populates="conversation", cascade="all, delete-orphan") @@ -487,7 +489,7 @@ class MessageFeedback(Base): message_id = Column( Integer, ForeignKey("messages.id"), nullable=False, index=True, comment="Message ID being rated" ) - uid = Column(String(64), nullable=False, index=True, comment="UID who provided feedback") + uid = Column(String(225), nullable=False, index=True, comment="UID who provided feedback(含服务账号 uid)") rating = Column(String(10), nullable=False, comment="Feedback rating: like or dislike") reason = Column(Text, nullable=True, comment="Optional reason for dislike feedback") created_at = Column(DateTime, default=utc_now_naive, comment="Feedback creation time") @@ -769,7 +771,7 @@ class AgentRun(Base): id = Column(String(64), primary_key=True, comment="Run ID (UUID)") thread_id = Column(String(64), index=True, nullable=False, comment="Thread ID") agent_id = Column(String(64), index=True, nullable=False, comment="Agent ID") - uid = Column(String(64), index=True, nullable=False, comment="UID") + uid = Column(String(225), index=True, nullable=False, comment="UID(含服务账号 uid,最长 225 字符)") status = Column( String(32), index=True, diff --git a/backend/package/yuxi/storage/postgres/models_channels.py b/backend/package/yuxi/storage/postgres/models_channels.py index 84d7888e..5f65b326 100644 --- a/backend/package/yuxi/storage/postgres/models_channels.py +++ b/backend/package/yuxi/storage/postgres/models_channels.py @@ -867,7 +867,9 @@ class ChannelContentReviewRecord(Base): # 关联上下文 channel_type = Column(String(32), nullable=False, index=True, comment="渠道类型(feishu / wechat / ...)") - account_id = Column(String(64), nullable=False, index=True, comment="渠道账户 ID") + account_id = Column( + String(128), nullable=False, index=True, comment="渠道账户 ID(对齐 channel_accounts.account_id)" + ) # 审核入参 resource_type = Column(