fix(migrations): complete Sub2API→claude2api pre-rename checksum compat (add 038)#3
Closed
dofastted wants to merge 2 commits into
Closed
fix(migrations): complete Sub2API→claude2api pre-rename checksum compat (add 038)#3dofastted wants to merge 2 commits into
dofastted wants to merge 2 commits into
Conversation
…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.
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
9afaa312(clean public repository presentation) 改写了 5 个 migration 文件,把首行注释Sub2API改为claude2api(038 还额外把一处 owner 归一化WHERE条件sub2api→claude2api)。这些改动 DDL/schema 完全不变,但改变了 trimmed-content checksum。已有部署(尤其从旧 sub2api 迁移而来的库)在schema_migrations里记录的是清理前 checksum,从源码 rebuild 的镜像会因 checksum mismatch 启动失败。32a46e33为其中 4 个文件(001/002/003/052)加了兼容规则,但 遗漏了 038。任何人从主干 rebuild 并部署到此类迁移库都会撞上:改动
本 PR 包含两个 commit:
32a46e33的内容(001/002/003/052 兼容规则)验证
用一台从 sub2api 迁移而来的生产库快照实测:打补丁前镜像因 038 checksum mismatch 启动失败;打补丁后容器正常 healthy,
/health=200,全程 0 次 checksum mismatch、0 次 Auto setup failed。已据此完成一次生产部署。