diff --git a/deploy/build.sh b/deploy/build.sh index a04292f..1c3f0b3 100755 --- a/deploy/build.sh +++ b/deploy/build.sh @@ -81,6 +81,17 @@ for tool in git npm; do done check_docker check_age_setup +if [[ -z "${SKIP_DB_MIGRATION_CHECK:-}" ]]; then + if command -v npx >/dev/null 2>&1; then + echo "Checking for pending Prisma migrations..." + if ! npx prisma migrate status >/dev/null 2>&1; then + echo "Prisma migrate status failed. Ensure DATABASE_URL is set and migrations are up to date." >&2 + exit 1 + fi + else + echo "npx not found; skipping Prisma migration check." >&2 + fi +fi GIT_SHA=$(git rev-parse --short HEAD 2>/dev/null || date +%s) BASE_TAG=${BUILD_TAG:-$GIT_SHA}