
ChristandClaude Opus 4.8
62705c524d
fix(db): 真实容器验证 Postgres/MySQL 方言修复
Docker 起 mysql:8 / postgres:16 实跑迁移+核心 CRUD,发现并修复三处阻断问题:
- pgx 不支持 ? 占位符:新增 pgx_compat driver 包裹 pgx stdlib,把 ? 重写为 $N
(internal/db/pgx_compat.go),driverPgx 指向它;全仓库 ? 写法零改动。
- pgx 对 BOOLEAN 严格按 bool 读写,与 int/boolToInt 写法不兼容:Postgres
migration 的 BOOLEAN 列改 INTEGER 0/1,与 SQLite/MySQL 对齐 (00001/00004/00008)。
- pgx 不支持 Result.LastInsertId:新增 insertReturningID helper,Postgres 走
INSERT ... RETURNING id,SQLite/MySQL 走 LastInsertId (Cards/Keywords/
Notifications/Automation 的 INSERT 路径)。
附带 MySQL 部署加固:parseDBURL 自动补 multiStatements=true(缺失会静默只执行
首条迁移语句);base_url TEXT→VARCHAR(512)(strict mode 拒绝 TEXT+DEFAULT)。
新增 cmd/dbverify 三库迁移+核心 CRUD 烟囱测试工具。
验证:SQLite/MySQL/Postgres 三库 9 步 CRUD 全通过;go test ./... 与 go vet 通过。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-06 16:51:38 +08:00
..
2026-07-06 12:35:01 +08:00
2026-07-06 12:35:01 +08:00
2026-07-06 12:35:01 +08:00
2026-06-30 21:41:03 +08:00
2026-07-06 16:51:38 +08:00
2026-07-06 12:35:01 +08:00
2026-06-30 21:41:03 +08:00
2026-07-06 12:35:01 +08:00
2026-07-06 12:58:23 +08:00
2026-07-06 12:27:37 +08:00
2026-07-06 12:27:37 +08:00