fix: 修复迁移预检状态误判(09-06-release-gate-integrity)

这个提交包含在:
2026-09-09 12:47:29 +08:00
父节点 b9185308a6
当前提交 81102c26cf
共修改 6 个文件,包含 189 行新增和 7 行删除
+15 -5
查看文件
@@ -190,20 +190,30 @@ printf '[production-preflight][PRISMA_STATUS_BEGIN]\n'
printf '%s\n' "$prisma_status_output"
printf '[production-preflight][PRISMA_STATUS_END] exit=%s\n' "$prisma_status_code"
if printf '%s' "$prisma_status_output" | grep -Eiq 'failed migration|migration(s)? have failed|migration failed|rolled back|diverged|drift|could not find migration|database schema is not in sync'; then
status_matches() {
local status
if grep -Ei -- "$1" <<<"$prisma_status_output" >/dev/null; then
return 0
else
status=$?
fi
[[ "$status" -eq 1 ]] || fail "PROD_MIGRATION_STATUS_UNREADABLE"
return 1
}
if status_matches 'failed migration|migration(s)? have failed|migration failed|rolled back|diverged|drift|could not find migration|database schema is not in sync'; then
fail "PROD_MIGRATION_STATUS_UNSAFE"
fi
if ! printf '%s' "$prisma_status_output" \
| grep -Eiq 'Database schema is up to date|have not yet been applied|No pending migrations'; then
if ! status_matches 'Database schema is up to date|have not yet been applied|No pending migrations'; then
fail "PROD_MIGRATION_STATUS_UNREADABLE"
fi
if [[ "$prisma_status_code" -ne 0 ]] \
&& ! printf '%s' "$prisma_status_output" | grep -Eiq 'have not yet been applied'; then
&& ! status_matches 'have not yet been applied'; then
fail "PROD_MIGRATION_STATUS_UNREADABLE"
fi
declare -a status_pending_ids=()
if printf '%s' "$prisma_status_output" | grep -Eiq 'have not yet been applied'; then
if status_matches 'have not yet been applied'; then
status_pending_text="$(printf '%s\n' "$prisma_status_output" | awk '
tolower($0) ~ /have not yet been applied/ { capture=1; next }
capture { print }