#!/bin/bash # 生产迁移治理入口(在 test-api 上执行) set -euo pipefail APP="${APP_DIR:-/opt/ai-fresh-delivery}" SERVER="$APP/server" MIGRATIONS_DIR="$APP/migrations" SCRIPT="$APP/scripts/prod-migration-governance.js" echo "===== 1/3 audit (before) =====" bash "$APP/scripts/prod-migration-audit.sh" 2>/dev/null || true echo "" echo "===== 2/3 governance apply =====" cd "$SERVER" export MIGRATIONS_DIR node "$SCRIPT" echo "" echo "===== 3/3 full migrate verify =====" export SKIP_DEMO_SEED=1 node migrate.js echo "" echo "===== audit (after) =====" bash "$APP/scripts/prod-migration-audit.sh" echo "" echo "===== health =====" curl -sf http://127.0.0.1:3001/api/health && echo echo "===== governance complete ====="