ai-chatbot/lib/db/migrations/0019_add_sub_model_support.sql
Your Name 53ddb7e585
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
Initial commit - clean repository
2025-12-17 20:15:18 +08:00

24 lines
937 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Migration: Add sub-model support for intelligent model selection
-- Date: 2025-12-09
-- Purpose: Support hierarchical model structure for Volcano Video service
-- Add sub-model related fields to AiModel table
ALTER TABLE "AiModel"
ADD COLUMN IF NOT EXISTS "is_sub_model" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN IF NOT EXISTS "parent_model_id" UUID;
-- Add comments for clarity
COMMENT ON COLUMN "AiModel"."is_sub_model" IS '是否为子模型(不在前端模型列表中显示)';
COMMENT ON COLUMN "AiModel"."parent_model_id" IS '父模型ID(如果is_sub_model=true)';
-- Create index for efficient sub-model queries
CREATE INDEX IF NOT EXISTS "idx_aimodel_sub_model"
ON "AiModel"("parent_model_id", "is_sub_model")
WHERE "is_sub_model" = true;
-- Create index for efficient parent model queries
CREATE INDEX IF NOT EXISTS "idx_aimodel_parent_model"
ON "AiModel"("id", "is_sub_model")
WHERE "is_sub_model" = false;