Skip to content

Commit cb2aa5e

Browse files
ci(migrations): fail dev db:push on interactive prompt or error
drizzle-kit push prompts interactively for ambiguous renames (--force only covers data-loss). In CI there's no TTY, so the prompt reads EOF and drizzle can exit 0 without applying — the job goes green while the schema change was silently skipped. Close stdin, reject prompt markers, and require a success marker so an unresolved rename or failed statement fails the job. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015orsjbLX34FPFGujSK3AQK
1 parent d22b025 commit cb2aa5e

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/migrations.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,20 @@ jobs:
6969
7070
if [ "${ENVIRONMENT}" = "dev" ]; then
7171
echo "Dev environment — pushing schema directly (db:push)"
72-
bun run db:push --force
72+
# drizzle-kit push prompts interactively for ambiguous renames (which
73+
# --force does NOT cover). With no TTY the prompt reads EOF and drizzle
74+
# can still exit 0 without applying — a false green. Close stdin, then
75+
# reject prompt markers and require a success marker so an unresolved
76+
# rename or failed statement fails the job instead of passing.
77+
bun run db:push --force < /dev/null 2>&1 | tee /tmp/db-push.log
78+
if grep -qE "created or renamed|Do you want" /tmp/db-push.log; then
79+
echo "ERROR: db:push hit an interactive rename prompt; resolve it with a versioned migration, not push." >&2
80+
exit 1
81+
fi
82+
if ! grep -qE "Changes applied|No changes detected|No schema changes" /tmp/db-push.log; then
83+
echo "ERROR: db:push did not confirm success (aborted prompt or failed statement)." >&2
84+
exit 1
85+
fi
7386
else
7487
echo "Applying versioned migrations (db:migrate)"
7588
bun run ./scripts/migrate.ts

0 commit comments

Comments
 (0)