Verbessere Docker-Migration: Entrypoint mit Baseline-Fallback und aktualisiere baseline-migrations.sh

This commit is contained in:
Hördle Bot
2025-11-28 15:53:01 +01:00
parent d874682764
commit 794e3fd74a
3 changed files with 22 additions and 7 deletions

View File

@@ -9,11 +9,23 @@ fi
echo "Starting deployment..."
# Run migrations
# Run migrations with fallback to baseline if needed
echo "Running database migrations..."
npx prisma migrate deploy
if ! npx prisma migrate deploy; then
echo "⚠️ Migration failed, attempting to baseline existing database..."
if [ -f /app/scripts/baseline-migrations.sh ]; then
sh /app/scripts/baseline-migrations.sh
echo "Retrying migrations after baseline..."
npx prisma migrate deploy || {
echo "❌ Migration failed even after baseline. Please check your database."
exit 1
}
else
echo "❌ ERROR: Migration failed and baseline script not found at /app/scripts/baseline-migrations.sh"
exit 1
fi
fi
echo "✅ Migrations completed successfully"
# Start the application
echo "Starting application..."