Skip to content

Commit 3b13560

Browse files
ci(migrations): fail dev db:push when drizzle-kit hits a TTY prompt
drizzle-kit push needs a TTY to resolve ambiguous renames; in CI it throws "Interactive prompts require a TTY terminal" but still exits 0, so the job went green without applying the schema (e.g. run 28415609570). Fail on that explicit error. Keys on drizzle's own stable message rather than fuzzy prompt text, and a real non-zero exit still fails via set -e. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015orsjbLX34FPFGujSK3AQK
1 parent cb2aa5e commit 3b13560

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

.github/workflows/migrations.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,14 @@ jobs:
6969
7070
if [ "${ENVIRONMENT}" = "dev" ]; then
7171
echo "Dev environment — pushing schema directly (db:push)"
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.
72+
# drizzle-kit push needs a TTY to resolve ambiguous renames (--force only
73+
# covers data-loss). In CI it throws "Interactive prompts require a TTY
74+
# terminal" but still exits 0, so the job goes green without applying the
75+
# change. tee keeps the output live in the log; we then fail on drizzle's
76+
# own TTY error. A genuine non-zero exit already fails via `set -e`.
7777
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
78+
if grep -q "Interactive prompts require a TTY terminal" /tmp/db-push.log; then
79+
echo "ERROR: db:push needs an interactive rename decision; land it as a versioned migration instead of relying on push." >&2
8480
exit 1
8581
fi
8682
else

0 commit comments

Comments
 (0)