Refine migration deployment process in entrypoint script: Capture exit code separately and display migration logs for better error handling and clarity during deployment.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m17s

This commit is contained in:
Julien Froidefond
2025-12-15 17:52:31 +01:00
parent 042b3128d4
commit d45475fb5a

View File

@@ -9,8 +9,13 @@ mkdir -p /app/public/uploads/backgrounds
deploy_migrations() { deploy_migrations() {
echo "Deploying migrations..." echo "Deploying migrations..."
# Try to deploy migrations # Try to deploy migrations and capture both output and exit code
if pnpm dlx prisma migrate deploy 2>&1 | tee /tmp/migrate.log; then # Use a temporary file to capture exit code since tee masks it
pnpm dlx prisma migrate deploy > /tmp/migrate.log 2>&1
MIGRATE_EXIT=$?
cat /tmp/migrate.log # Display output
if [ $MIGRATE_EXIT -eq 0 ]; then
echo "Migrations deployed successfully" echo "Migrations deployed successfully"
return 0 return 0
fi fi