Files
qipai/docs/db-changelog/2026-06-18-M02-B-wechat-auth.md
2026-06-18 10:46:39 +08:00

21 lines
1017 B
Markdown
Raw Permalink 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.
# M02-B 微信身份与可撤销会话
- 迁移版本:`2026061804`
- Up`database/migrations/2026061804_m02b_wechat_auth.up.sql`
- Down`database/migrations/2026061804_m02b_wechat_auth.down.sql`
- Verify`database/migrations/2026061804_m02b_wechat_auth.verify.sql`
## 新增表
| 表 | 用途 | 关键约束 |
|---|---|---|
| `qipai_users` | 租户内用户主体 | `tenant_id`、状态、用户类型和 `role_version` |
| `qipai_user_identities` | 按租户及 AppID 保存 OpenID/UnionID | 唯一键为 `tenant_id, platform_app_id, openid` |
| `qipai_auth_sessions` | 服务端可撤销登录会话 | 记录用户、应用、角色版本、过期与撤销状态 |
同一租户、同一应用、同一 OpenID 重复登录复用用户;不同租户即使使用同一 AppID,也不会共享用户主体。
## 实测
WSL MySQL 8.4.9 临时库完成 `up → verify → down → up → verify`。重复 OpenID 登录复用用户、主动注销失效、`role_version` 增加后旧会话失效均通过。