落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
702 B
SQL
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)
|
|
);
|