mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:41:09 +02:00
🐛 fix(ci): add db:push fallback when migrations fail
If db:migrate fails (e.g., due to migration hash mismatch after modifying an already-applied migration), fall back to db:push which syncs the schema directly. This ensures the database schema is always up-to-date even when migration tracking gets out of sync. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ffc41b2b1d
commit
f834986a82
1 changed files with 8 additions and 3 deletions
11
.github/workflows/cd-staging.yml
vendored
11
.github/workflows/cd-staging.yml
vendored
|
|
@ -280,12 +280,17 @@ jobs:
|
|||
if docker compose exec -T mana-core-auth test -f src/db/migrate.ts 2>/dev/null || \
|
||||
docker compose exec -T mana-core-auth pnpm run db:migrate --help 2>/dev/null; then
|
||||
run_migration mana-core-auth || {
|
||||
echo "❌ mana-core-auth migration failed - aborting deployment"
|
||||
exit 1
|
||||
echo "⚠️ mana-core-auth migration failed - falling back to db:push"
|
||||
echo " This syncs schema directly, bypassing migration tracking"
|
||||
docker compose exec -T mana-core-auth pnpm run db:push || {
|
||||
echo "❌ mana-core-auth db:push also failed - aborting deployment"
|
||||
exit 1
|
||||
}
|
||||
echo "✅ [mana-core-auth] Schema synced via db:push"
|
||||
}
|
||||
else
|
||||
echo "⏭️ [mana-core-auth] No db:migrate script, using db:push..."
|
||||
docker compose exec -T mana-core-auth npx drizzle-kit push --force || echo "Auth schema push completed"
|
||||
docker compose exec -T mana-core-auth pnpm run db:push || echo "Auth schema push completed"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue