From 5e9a7888aec81175b5b236a6a8d568ae18be92ea Mon Sep 17 00:00:00 2001 From: wangbo Date: Mon, 3 Aug 2026 09:23:34 +0800 Subject: [PATCH] =?UTF-8?q?chore(migration):=20=E7=99=BB=E8=AE=B0=20Worker?= =?UTF-8?q?=20=E8=B4=9F=E8=BD=BD=E8=BF=81=E7=A7=BB=E5=AE=89=E5=85=A8?= =?UTF-8?q?=E5=AE=A1=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 基于宁波生产 PostgreSQL 18 的只读预检,gateway_worker_instances 当前为 96 行、180224 字节,常量默认值新增列不会触发表重写,回填和约束验证范围可控。\n\ngateway_concurrency_leases 仅增加可空列;记录迁移校验器允许的 non-null column addition,并保留迁移文件不可变。\n\n验证:node scripts/ci-validate-migrations.mjs ac8d6dcf452ac555eb344f76caf6965c2ea42a97;./tests/ci/migrations-test.sh --- scripts/migration-safety-reviewed.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/migration-safety-reviewed.json b/scripts/migration-safety-reviewed.json index e3f091e..213e9e9 100644 --- a/scripts/migration-safety-reviewed.json +++ b/scripts/migration-safety-reviewed.json @@ -30,6 +30,13 @@ "destructive DROP operation" ], "reason": "The migration replaces only the existing Worker status CHECK constraint so a rolling deployment can mark lost instances stale. It does not drop data, columns, tables, or indexes; the old and new binaries both continue to read active and draining rows safely." + }, + "apps/api/migrations/0101_worker_adaptive_load.sql": { + "sha256": "4a23a194b9244f0afe245ceb8ff47ee03ca7d3e732e5593f731380bdf3dd77ae", + "allowedViolations": [ + "non-null column addition" + ], + "reason": "The adaptive Worker columns use constant defaults on gateway_worker_instances, so PostgreSQL 18 can add them without rewriting the table. Production preflight on 2026-08-03 found 96 rows and a 180224-byte relation; the explicit backfill and constraint validation are therefore bounded. The only change to the 31899648-byte gateway_concurrency_leases relation is a nullable numeric column and a NOT VALID check followed by validation." } } }