fix: 修复迁移预检状态误判(09-06-release-gate-integrity)
这个提交包含在:
@@ -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 }
|
||||
|
||||
在新工单中引用
屏蔽一个用户