Skip to content

fix(migrations): complete Sub2API→claude2api pre-rename checksum compat (add 038)#3

Closed
dofastted wants to merge 2 commits into
mainfrom
fix/migration-checksum-compat-038
Closed

fix(migrations): complete Sub2API→claude2api pre-rename checksum compat (add 038)#3
dofastted wants to merge 2 commits into
mainfrom
fix/migration-checksum-compat-038

Conversation

@dofastted

Copy link
Copy Markdown
Owner

背景

9afaa312 (clean public repository presentation) 改写了 5 个 migration 文件,把首行注释 Sub2API 改为 claude2api(038 还额外把一处 owner 归一化 WHERE 条件 sub2apiclaude2api)。这些改动 DDL/schema 完全不变,但改变了 trimmed-content checksum。已有部署(尤其从旧 sub2api 迁移而来的库)在 schema_migrations 里记录的是清理前 checksum,从源码 rebuild 的镜像会因 checksum mismatch 启动失败

32a46e33 为其中 4 个文件(001/002/003/052)加了兼容规则,但 遗漏了 038。任何人从主干 rebuild 并部署到此类迁移库都会撞上:

038_..._classification.sql checksum mismatch (db=4cc121d9... file=3281353a...)

改动

本 PR 包含两个 commit:

  1. 32a46e33 的内容(001/002/003/052 兼容规则)
  2. 新增 038 兼容规则,补全 9afaa31 影响的全部 5 个文件

验证

用一台从 sub2api 迁移而来的生产库快照实测:打补丁前镜像因 038 checksum mismatch 启动失败;打补丁后容器正常 healthy,/health=200,全程 0 次 checksum mismatch、0 次 Auto setup failed。已据此完成一次生产部署。

Claude Code via ted and others added 2 commits June 24, 2026 22:47
…cleanup

The repository-presentation cleanup (9afaa31) rewrote the first comment
line of several migration files from "Sub2API" to "claude2api". This
changed their trimmed-content checksums while leaving DDL and resulting
schema identical. Existing deployments recorded the pre-cleanup checksums
in schema_migrations, so rebuilding the image from source fails startup
with a checksum mismatch.

Add compatibility rules for the four affected, already-applied files
(001_init, 002_account_type_migration, 003_subscription,
052_migrate_upstream_to_apikey) so the new checksum is accepted against
the legacy DB checksum without modifying migrations or the database.
051 is unaffected (its content trims to empty, identical checksum).
)

32a46e3 covered the four files touched by 9afaa31's Sub2API->claude2api
cleanup but missed 038_ops_errors_..._classification.sql, which the same
cleanup also rewrote (first-line comment + one owner-normalization WHERE
condition sub2api->claude2api). The migration was already applied on the
green/sub2api-migrated DB, so DDL/data are unaffected; only its trimmed
checksum changed. Without this rule, rebuilding from source fails startup
with a 038 checksum mismatch (db=4cc121d9..., file=3281353a...).

Verified by booting the image against a restored production snapshot.
@dofastted

Copy link
Copy Markdown
Owner Author

已被 #2 完整包含(32a46e3 四条兼容规则 + 038 补全),随 #2 squash 合并入 main,故关闭。

@dofastted dofastted closed this Jun 24, 2026
@dofastted dofastted deleted the fix/migration-checksum-compat-038 branch June 24, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant