`migrate dev` hangs on the migration name prompt when stdin is not a TTY
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- nodejs, sqlite, typescript
Research direction
The bug is in packages/migrate/src/utils/promptForMigrationName.ts, around line 21, where the non-interactive check tests the isInteractive function without calling it. Other commands use canPrompt() for this check, which the reporter suggests reusing. Done means npx prisma migrate dev < /dev/null creates the migration with the default name and exits instead of waiting at the prompt. The reporter already links a fix in PR 30941, so check that before starting.
Written by the indexing model from the issue text.
Description
Package and version
What happened?
prisma migrate dev without --name hangs forever on "Enter a name for the new migration:" when stdin is not a terminal (e.g. if it's a script or a coding agent).
What did you expect to happen?
The prompt should be skipped and the migration created with the default empty name, same as when CI=1 is set.
Minimal reproduction
Repro in arbitrary project
If you already have a Prisma project at hand, just change the schema to trigger a migration and then run npx prisma migrate dev < /dev/null. Prisma will prompt for a migration name and then hang.
Full repro
Project setup:
mkdir repro && cd repro && npm init -y
npm i -D [email protected] && npm i @prisma/[email protected]
cat > schema.prisma <<'EOS'
generator client {
provider = "prisma-client"
output = "./generated"
}
datasource db {
provider = "sqlite"
}
model User {
id Int @id @default(autoincrement())
}
EOS
cat > prisma.config.ts <<'EOS'
import { defineConfig } from "prisma/config";
export default defineConfig({
schema: "schema.prisma",
migrations: { path: "migrations" },
datasource: { url: "file:./dev.db" },
});
EOS
Broken behavior:
npx prisma migrate dev < /dev/null
# prints "? Enter a name for the new migration: ›" and never exits
Working behavior:
CI=1 npx prisma migrate dev < /dev/null
# ccreates the migration with the default name and exits 0
Environment
- Node: 24.14.1
- OS: EndeavourOS (Arch Linux), kernel 7.2.2
- Package manager: npm 11.19.0
- Database: SQLite (file:./dev.db)
- Schema Engine: schema-engine-cli d1b3f377ca835d73fd50954a5e22128b9ebdd6b8
Additional context
This happens because the check that should skip the prompt forgets to call the isInteractive function which always results in a falsy value. The condition should be !isInteractive(), not !isInteractive:
https://github.com/prisma/orm/blob/97ea359250335c1a174504c9b2b7e5fe030ab937/packages/migrate/src/utils/promptForMigrationName.ts#L21
This has been broken since https://github.com/prisma/orm/pull/15008.
Instead of fixing the call to isInteractive, the cleaner fix is to just call the canPrompt() function. All other commands already do this. I fixed this in https://github.com/prisma/orm/pull/30941.
- Dominant language
- TypeScript
- Stars
- 47.8k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 227
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from prisma/orm
-
bug/1-unconfirmed kind/bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
get-platform: distros with ID_LIKE=alpine are not detected as musl, so glibc engines are used on Alpine-based imagesPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
prisma/orm#31281 · 1 comment ·
Maintainers usually reply within 1 day
-
adapter-pg: connectToShadowDb connects to the main database when built from a connection stringMay be free again @cestercian claimed this 10 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
prisma/orm#31196 · 1 comment ·
Maintainers usually reply within 1 day
-
[Prisma 8] Type-check time grows exponentially with chained .include() callsPossibly taken @SiKreuz claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
prisma/orm#31161 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
prisma/orm#31125 · 4 comments · 6 reactions ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
tenstorrent/ttnn-visualizer#2526 ·
Maintainers usually reply within 1 day
-
trySessionCache calls /get-session twice when minting session_data (cache miss or expired cookie)Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
neondatabase/neon-js#301 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tashfeenahmed/freellmapi#2305 ·
Maintainers usually reply within 1 day