Add Prisma migration preflight check to build
This commit is contained in:
parent
0635a49702
commit
b89f7ce129
1 changed files with 11 additions and 0 deletions
|
|
@ -81,6 +81,17 @@ for tool in git npm; do
|
||||||
done
|
done
|
||||||
check_docker
|
check_docker
|
||||||
check_age_setup
|
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)
|
GIT_SHA=$(git rev-parse --short HEAD 2>/dev/null || date +%s)
|
||||||
BASE_TAG=${BUILD_TAG:-$GIT_SHA}
|
BASE_TAG=${BUILD_TAG:-$GIT_SHA}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue