Files
digital-psychology/apps/api/migrations/000041_crisis_events.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

19 lines
705 B
SQL

-- ECR-031 CrisisEvent (read catalog)
CREATE TABLE IF NOT EXISTS crisis_events (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
code varchar(64) NOT NULL UNIQUE,
title varchar(128) NOT NULL,
severity varchar(16) NOT NULL CHECK (severity IN ('high','critical')),
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_crisis_events_active ON crisis_events(active);
INSERT INTO crisis_events(code, title, severity, active, system)
VALUES ('demo_crisis_event', '示例危机事件占位', 'high', true, true)
ON CONFLICT (code) DO NOTHING;