From f834986a825c8ec07cff9e8d6392db4cd91408e4 Mon Sep 17 00:00:00 2001 From: Wuesteon Date: Thu, 18 Dec 2025 23:26:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ci):=20add=20db:push=20fallb?= =?UTF-8?q?ack=20when=20migrations=20fail?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/cd-staging.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd-staging.yml b/.github/workflows/cd-staging.yml index 4ecc7e9c9..64a4ae52e 100644 --- a/.github/workflows/cd-staging.yml +++ b/.github/workflows/cd-staging.yml @@ -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 ""