ai-chatbot/lib/db/migrations/0023_add_featured_and_department.sql
Your Name 7a4fa8e1d8
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
添加钉钉集成、精选作品和排行榜功能
2025-12-18 15:12:34 +08:00

15 lines
703 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.

-- 迁移文件:0023_add_featured_and_department.sql
-- 功能:添加精选功能和部门信息字段
-- 1. User 表添加部门字段
ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "department" varchar(256) DEFAULT NULL;
-- 2. GeneratedImage 表添加精选字段
ALTER TABLE "GeneratedImage" ADD COLUMN IF NOT EXISTS "isFeatured" boolean DEFAULT false NOT NULL;
ALTER TABLE "GeneratedImage" ADD COLUMN IF NOT EXISTS "featuredAt" timestamp DEFAULT NULL;
ALTER TABLE "GeneratedImage" ADD COLUMN IF NOT EXISTS "featuredBy" uuid DEFAULT NULL;
-- 3. 创建精选索引加速查询
CREATE INDEX IF NOT EXISTS "idx_generated_image_featured" ON "GeneratedImage"("isFeatured") WHERE "isFeatured" = true;