-- 20260331000002_agent_templates_extensions.sql
-- 行业 Agent 模板扩展: soul_content, scenarios, welcome_message, quick_commands 等

ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS soul_content TEXT;
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS scenarios TEXT NOT NULL DEFAULT '[]';
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS welcome_message TEXT;
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS quick_commands TEXT NOT NULL DEFAULT '[]';
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS personality TEXT;
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS communication_style TEXT;
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS emoji TEXT;
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS version INTEGER NOT NULL DEFAULT 1;
ALTER TABLE agent_templates ADD COLUMN IF NOT EXISTS source_id TEXT;

-- source_id 唯一约束（仅非 NULL 值）
CREATE UNIQUE INDEX IF NOT EXISTS idx_agent_templates_source_id
  ON agent_templates(source_id) WHERE source_id IS NOT NULL;
