Files
medical-mall/pages/user/test/USER_AUTH_TEST_DATA.sql
2026-01-30 16:17:13 +08:00

36 lines
1.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ============================================
-- 用户登录 / 注册 测试数据
-- 位置pages/user/test/USER_AUTH_TEST_DATA.sql
-- 用途:
-- - 准备少量业务侧测试数据,方便前端联调登录/个人中心
-- - 注意Supabase 的 auth.users 建议通过实际“注册”流程生成,这里不直接插入
-- ============================================
-- 1. 如果你已经通过注册页创建了账号auth.users 中有记录),
-- 可以在 ak_users 中补充一条测试资料:
-- 把 '00000000-0000-0000-0000-000000000001' 替换成自己 auth.users 里的 id。
insert into public.ak_users (id, username, email, role)
values
('00000000-0000-0000-0000-000000000001', 'demo_user', 'demo@example.com', 'analyst')
on conflict (id) do update
set
username = excluded.username,
email = excluded.email,
role = excluded.role;
-- 2. 可选:补充 users / user_sessions 基础数据,方便分析模块统计演示
insert into public.users (id, email, nickname)
values
('00000000-0000-0000-0000-000000000001', 'demo@example.com', 'Demo 分析师')
on conflict (id) do update
set
email = excluded.email,
nickname = excluded.nickname;
insert into public.user_sessions (user_id, session_token, is_active)
values
('00000000-0000-0000-0000-000000000001', 'demo-session-token', true);