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

23 lines
1.1 KiB
SQL

-- Synastry social: profile geo + invite tokens
ALTER TABLE profiles ADD COLUMN IF NOT EXISTS geo_lat double precision NULL;
ALTER TABLE profiles ADD COLUMN IF NOT EXISTS geo_lng double precision NULL;
ALTER TABLE profiles ADD COLUMN IF NOT EXISTS geo_visible boolean NOT NULL DEFAULT false;
CREATE TABLE IF NOT EXISTS synastry_invites (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
token varchar(64) NOT NULL UNIQUE,
host_user_id uuid NOT NULL REFERENCES users(id),
host_profile_id uuid NOT NULL REFERENCES profiles(id),
expires_at timestamptz NOT NULL,
guest_user_id uuid NULL REFERENCES users(id),
guest_profile_id uuid NULL REFERENCES profiles(id),
report_id uuid NULL REFERENCES growth_reports(id),
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
deleted_at timestamptz NULL
);
CREATE INDEX IF NOT EXISTS idx_synastry_invites_token ON synastry_invites(token);
CREATE INDEX IF NOT EXISTS idx_synastry_invites_host ON synastry_invites(host_user_id);
CREATE INDEX IF NOT EXISTS idx_profiles_geo_visible ON profiles(geo_visible) WHERE geo_visible = true AND deleted_at IS NULL;