ai-chatbot/lib/db/migrations_legacy/0023_add_featured_and_department.sql
Your Name 310dd115b2
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore(db): keep drizzle migrations folder journal-only
2026-02-14 01:30:51 +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;