Revert "fix(deployment): handle failed migrations automatically in docker-entrypoint"
This reverts commit 3c4e273e26.
This commit is contained in:
1
QWEN.md
1
QWEN.md
@@ -233,4 +233,3 @@ Common issues and solutions:
|
|||||||
|
|
||||||
## Qwen Added Memories
|
## Qwen Added Memories
|
||||||
- **GitHub Workflows**: Project ini memiliki workflow GitHub Action untuk deployment. User akan menangani workflow secara manual di GitHub.
|
- **GitHub Workflows**: Project ini memiliki workflow GitHub Action untuk deployment. User akan menangani workflow secara manual di GitHub.
|
||||||
- **Auto Branch Creation**: Saat memperbaiki/mengerjakan sesuatu, otomatis buat branch baru dengan format: `fix/<deskripsi>-<YYYY-MM-DD>` atau `feat/<deskripsi>-<YYYY-MM-DD>` lalu push ke `deploy/stg`. Contoh: `fix/filestorage-path-2026-04-14`
|
|
||||||
|
|||||||
@@ -3,30 +3,11 @@ set -e
|
|||||||
|
|
||||||
echo "🔄 Running database migrations..."
|
echo "🔄 Running database migrations..."
|
||||||
cd /app
|
cd /app
|
||||||
|
bunx prisma migrate deploy || {
|
||||||
# Check for failed migrations and resolve them first
|
echo "❌ Migration failed!"
|
||||||
FAILED_MIGRATION=$(bunx prisma migrate status 2>&1 | grep -A 1 "failed" | grep -oP '\d{14}_\w+' | head -1 || true)
|
exit 1
|
||||||
|
}
|
||||||
if [ ! -z "$FAILED_MIGRATION" ]; then
|
echo "✅ Migrations completed successfully"
|
||||||
echo "⚠️ Found failed migration: $FAILED_MIGRATION"
|
|
||||||
echo "🔧 Attempting to resolve (mark as rolled back)..."
|
|
||||||
bunx prisma migrate resolve --rolled-back "$FAILED_MIGRATION" || {
|
|
||||||
echo "❌ Failed to resolve migration. Trying db push instead..."
|
|
||||||
echo "📡 Pushing schema directly to database..."
|
|
||||||
bunx prisma db push --accept-data-loss || {
|
|
||||||
echo "❌ Schema push failed!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo "📡 Running standard migrations..."
|
|
||||||
bunx prisma migrate deploy || {
|
|
||||||
echo "❌ Migration failed!"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✅ Database schema updated successfully"
|
|
||||||
|
|
||||||
echo "🚀 Starting application..."
|
echo "🚀 Starting application..."
|
||||||
exec bun start
|
exec bun start
|
||||||
|
|||||||
Reference in New Issue
Block a user