Files
digital-psychology/apps/api/migrations/000006_companion_p2.up.sql
T
jackyu66gitandCursor bd22d9dddd feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-03 11:37:53 +08:00

22 lines
702 B
SQL

-- Companion moods + (optional) image-card daily quota counter
CREATE TABLE IF NOT EXISTS moods (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
user_id uuid NOT NULL REFERENCES users(id),
day date NOT NULL,
score int NULL CHECK (score IS NULL OR (score >= 1 AND score <= 5)),
note text NULL,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
deleted_at timestamptz NULL,
UNIQUE (user_id, day)
);
CREATE INDEX IF NOT EXISTS idx_moods_user_id ON moods(user_id);
CREATE TABLE IF NOT EXISTS image_card_quotas (
user_id uuid NOT NULL REFERENCES users(id),
day date NOT NULL,
used int NOT NULL DEFAULT 0,
PRIMARY KEY (user_id, day)
);