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='文档向量表';
