nex_docus/backend/scripts/create_document_vector_tabl...

13 lines
739 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

CREATE TABLE IF NOT EXISTS document_vector (
id BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '向量ID',
project_id BIGINT NOT NULL COMMENT '项目ID',
file_path VARCHAR(500) NOT NULL COMMENT '文件相对路径',
content_hash VARCHAR(64) COMMENT '内容哈希',
vector JSON COMMENT '向量数据JSON数组',
metadata JSON COMMENT '向量元数据',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
INDEX idx_project_file (project_id, file_path),
INDEX idx_created_at (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文档向量表';