Skip to content
Latchkey

Prisma "migrate dev" prompts and fails in CI (use migrate deploy)

prisma migrate dev is a development command: it can generate new migrations, prompt, and reset the database. In CI you want migrate deploy, which only applies existing migrations non-interactively.

What this error means

A CI step using prisma migrate dev hangs on a prompt, errors that it cannot run interactively, or unexpectedly resets data.

Prisma
Prisma Migrate has detected that the environment is non-interactive. It is recommended to use `prisma migrate deploy` in CI/CD environments.
Error: This command is not supported in a non-interactive environment.

Common causes

migrate dev used in a pipeline

migrate dev expects a developer at a prompt and may create or reset migrations, which is wrong for CI.

Expecting dev-style behavior in deploy

Teams sometimes reach for migrate dev to also generate migrations in CI, which it should not do in a pipeline.

How to fix it

Use migrate deploy in CI

Apply committed migrations only, without prompts or resets.

.github/workflows/ci.yml
- run: npx prisma migrate deploy

Generate migrations locally, apply in CI

  1. Run prisma migrate dev locally to author and commit migrations.
  2. Commit the generated migration folders.
  3. Let CI run only prisma migrate deploy.
Terminal
# local
npx prisma migrate dev --name add_users
# CI applies committed migrations
npx prisma migrate deploy

How to prevent it

  • Reserve migrate dev for local development only.
  • Use migrate deploy in every CI/CD pipeline.
  • Commit migration folders so deploy has them to apply.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →