Files
digital-psychology/apps/api/migrations/000036_ops_scheduled_publications.up.sql
T
jackyu66gitandCursor b7b0b18802 fix(db): 重编号合并后撞号 migration,并修 admin e2e base
将 015–023 双文件冲突线性化为 015–050;提供已有库 schema_migrations 修复脚本;admin Playwright 对齐 /psy/admin/ 预览路径。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 02:14:52 +08:00

20 lines
845 B
SQL

-- ECR-026 ScheduledPublication (read catalog)
CREATE TABLE IF NOT EXISTS ops_scheduled_publications (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
code varchar(64) NOT NULL UNIQUE,
title varchar(128) NOT NULL,
target_kind varchar(32) NOT NULL CHECK (target_kind IN ('banner','feed_slot')),
target_code varchar(64) NOT NULL,
active boolean NOT NULL DEFAULT true,
system boolean NOT NULL DEFAULT false,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_ops_scheduled_publications_active ON ops_scheduled_publications(active);
INSERT INTO ops_scheduled_publications(code, title, target_kind, target_code, active, system)
VALUES ('home_banner_week', '首页横幅周排期占位', 'banner', 'home_promo', true, true)
ON CONFLICT (code) DO NOTHING;