From 40bc565a49bd07ec038907a4e6ecabebe85fd740 Mon Sep 17 00:00:00 2001 From: jesse-ux Date: Wed, 14 Oct 2026 21:02:19 +0800 Subject: [PATCH] docs(testing): keep the host rehearsal sheet and record the local PostgreSQL 17 drill Co-Authored-By: Grok (agent loop) --- ...production-migration-rehearsal-20261014.md | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/testing/production-migration-rehearsal-20261014.md b/docs/testing/production-migration-rehearsal-20261014.md index 59967fb4..44fadcd1 100644 --- a/docs/testing/production-migration-rehearsal-20261014.md +++ b/docs/testing/production-migration-rehearsal-20261014.md @@ -1,8 +1,8 @@ # 生产迁移演练记录(2026-10-14) -本机 Docker,镜像 `postgres:17-alpine`,和 `npm run test:db` 用的是同一个 fixture。没有连生产主机,没有点生产按钮。数据是虚构的,每种关键表一行。下面只记计数、退出码和是否一致。 +## 本机 PostgreSQL 17 -## 步骤 +本机 Docker,镜像 `postgres:17-alpine`,和 `npm run test:db` 用的是同一个 fixture。没有连生产主机,没有点生产按钮。数据是虚构的,每种关键表一行。下面只记计数、退出码和是否一致。 1. 建库后套用生产当前版本:`frontend/db/migrations` 全部,加上 `frontend/supabase/migrations` 里文件名早于 `20260816010000` 的文件。Windows 上有 4 个同名文件,内容一致,只留一份。 2. 用恢复脚本同款方式导出:`pg_dump --format=custom`。再用 openssl `aes-256-cbc -salt -pbkdf2` 加密,然后解密。密钥没有写进仓库。 @@ -10,8 +10,6 @@ 4. 再还原一份,跑 `deploy/rehearse-production-migrations.sh` 的本地模式。 5. 再按手册还原一份。先把登录身份设成库里已有的一条账户,再 `set role authenticated`,读 `public.profiles`。 -## 结果 - | 项 | 值 | | --- | --- | | 基线迁移文件 | 111 | @@ -39,3 +37,29 @@ | authenticated 读到的行 | 1 | `notice_lines=161` 是这次空库演练里迁移提示的行数,不是生产上的标题修补人数。生产上仍按手册:标题修补不是 0 就停。 + +## 主机演练(产品填写) + +产品在主机上跑完 `deploy/rehearse-production-migrations.sh` 后填写。只写行数和通过/停止。不要写姓名、出生时间、邮箱、会话正文、密钥或任何一行的内容。 + +| 项 | 结果 | +| --- | --- | +| 日期 | | +| 发布修订 R | | +| 恢复点引用 | | +| 一次性库名字(必须是 `rehearse_` 开头) | | +| `other_person_accepted_rows` | 预期 0 | +| 归档会话:迁移前非空行数 / 迁移后 | 迁移后应为 0 | +| 人物表里本人镜像:迁移前 / 迁移后 | 迁移后应为 0 | +| 标题修补两条 NOTICE | 生产上预期都是 0。不是 0 就停止 | +| 自动标题回填 NOTICE | 只写数字 | +| 未知时间改成时段比较的行数 | | +| 家人整点改为已采用的行数 | | +| 时段回填的行数 | | +| 无日期证据改为已确认的行数 | | +| 网页角色读账户资料 | true 才算过 | +| 网页角色读会话列表 | true 才算过 | +| 服务角色读人物表 | true 才算过。false 时脚本退出码 4,停止,不要点生产迁移。这是演练库里的结果,不是正在服务的生产库 | +| 最终一行 | `rehearsal_ok=1` 才算演练通过 | + +停止时:生产库不应被修改。把脚本打印的那一句原因贴在这里,去掉任何连接地址。