Persist auth store into formal tables

This commit is contained in:
2026-05-13 23:24:32 +08:00
parent e8648e45fc
commit 166544fae6
14 changed files with 452 additions and 32 deletions

View File

@@ -23,7 +23,7 @@ spacetime sql <db> "SELECT * FROM custom_world_gallery_entry"
| 领域 | 表 |
| --- | --- |
| 运维迁移 | `database_migration_operator`, `database_migration_import_chunk` |
| 认证 | `auth_store_snapshot`, `user_account`, `auth_identity`, `refresh_session` |
| 认证 | `auth_store_snapshot`, `auth_store_projection_meta`, `user_account`, `auth_identity`, `refresh_session` |
| 运行时档案 | `runtime_setting`, `runtime_snapshot`, `user_browse_history`, `profile_dashboard_state`, `profile_wallet_ledger`, `analytics_date_dimension`, `tracking_event`, `tracking_daily_stat`, `profile_task_config`, `profile_task_progress`, `profile_task_reward_claim`, `profile_redeem_code`, `profile_redeem_code_usage`, `profile_invite_code`, `profile_referral_relation`, `profile_played_world`, `profile_membership`, `profile_recharge_order`, `profile_feedback_submission`, `profile_save_archive` |
| RPG 运行时 | `story_session`, `story_event`, `npc_state`, `inventory_slot`, `battle_state`, `treasure_record`, `quest_record`, `quest_log`, `player_progression`, `chapter_progression` |
| 世界创作 | `custom_world_profile`, `custom_world_session`, `custom_world_agent_session`, `custom_world_agent_message`, `custom_world_agent_operation`, `custom_world_draft_card`, `custom_world_gallery_entry` |
@@ -60,7 +60,7 @@ SELECT * FROM database_migration_operator WHERE operator_identity = '<identity>'
### `auth_store_snapshot`
- 作用:保存旧内存认证仓储的整份 JSON 快照,用于迁移和恢复;后续正式表拆分后仍可作为导入/导出桥
- 作用:保存旧内存认证仓储的整份 JSON 快照,用于历史迁移和兜底恢复;运行期认证同步不再继续刷新 `snapshot_id = 'default'`,而是直接导入正式认证表
- 结构:`snapshot_id PK: String`, `snapshot_json: String`, `updated_at: Timestamp`
- 索引:主键 `snapshot_id`
@@ -69,6 +69,17 @@ SELECT * FROM auth_store_snapshot;
SELECT * FROM auth_store_snapshot WHERE snapshot_id = 'default';
```
### `auth_store_projection_meta`
- 作用:记录正式认证表最近一次由认证快照导入的时间,避免启动恢复时旧 `auth_store_snapshot/default` 因带有时间戳而覆盖较新的正式认证表。
- 结构:`meta_id PK: String`, `updated_at: Timestamp`
- 索引:主键 `meta_id`
```sql
SELECT * FROM auth_store_projection_meta;
SELECT * FROM auth_store_projection_meta WHERE meta_id = 'default';
```
### `user_account`
- 作用用户账号主表保存用户名、公开百梦号、手机号掩码、登录方式、密码登录开关、token 版本和默认不前端展示的运营标签。