落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
950 B
SQL
24 lines
950 B
SQL
-- Ask threads & messages (AI 成长助手)
|
|
|
|
CREATE TABLE IF NOT EXISTS ask_threads (
|
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id uuid NOT NULL REFERENCES users(id),
|
|
profile_id uuid NOT NULL REFERENCES profiles(id),
|
|
scene varchar(32) NULL,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
deleted_at timestamptz NULL
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_ask_threads_user_id ON ask_threads(user_id);
|
|
CREATE INDEX IF NOT EXISTS idx_ask_threads_profile_id ON ask_threads(profile_id);
|
|
|
|
CREATE TABLE IF NOT EXISTS ask_messages (
|
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
thread_id uuid NOT NULL REFERENCES ask_threads(id),
|
|
role varchar(16) NOT NULL CHECK (role IN ('user', 'assistant')),
|
|
content text NOT NULL,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
deleted_at timestamptz NULL
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_ask_messages_thread_id ON ask_messages(thread_id);
|