Files
digital-psychology/apps/api/migrations/000002_relation.up.sql
T
jackyu66gitandCursor 14b836f53b feat: add RelationInsight API and wire H5 relation/profile pages
Second P1 growth engine: compare two profiles, gate full tips behind
deep-access mock payment, and list personal archives on /profile.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 16:28:10 +08:00

14 lines
669 B
SQL

CREATE TABLE IF NOT EXISTS relation_insights (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
user_id uuid NOT NULL REFERENCES users(id),
profile_a_id uuid NOT NULL REFERENCES profiles(id),
profile_b_id uuid NOT NULL REFERENCES profiles(id),
summary jsonb NOT NULL DEFAULT '{}',
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_relation_insights_user_id ON relation_insights(user_id);
CREATE INDEX IF NOT EXISTS idx_relation_insights_profiles ON relation_insights(profile_a_id, profile_b_id);