fix(schema): sync ORM entities with database schema

- Add missing 'type' column to MessageORM entity
- Add 'TEXT_WITH_ATTACHMENTS' to messages.type CHECK constraint
  (matches MessageType enum in conversation-service)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-23 05:00:38 -08:00
parent fcffaebdc9
commit 0f56cea96a
2 changed files with 4 additions and 1 deletions

View File

@ -16,6 +16,9 @@ export class MessageORM {
@Column({ length: 20 })
role: string;
@Column({ length: 30, default: 'TEXT' })
type: string;
@Column('text')
content: string;

View File

@ -117,7 +117,7 @@ CREATE TABLE messages (
role VARCHAR(20) NOT NULL CHECK (role IN ('user', 'assistant', 'system')),
-- 消息类型
type VARCHAR(30) NOT NULL DEFAULT 'TEXT'
CHECK (type IN ('TEXT', 'TOOL_CALL', 'TOOL_RESULT', 'PAYMENT_REQUEST', 'ASSESSMENT_START', 'ASSESSMENT_RESULT')),
CHECK (type IN ('TEXT', 'TEXT_WITH_ATTACHMENTS', 'TOOL_CALL', 'TOOL_RESULT', 'PAYMENT_REQUEST', 'ASSESSMENT_START', 'ASSESSMENT_RESULT')),
-- 消息内容
content TEXT NOT NULL,
-- 元数据工具调用信息、Token使用等