Repository navigation
Description
Describe the Bug
If a Postgres/SQLite database has ever been touched by Payload in dev mode (push enabled, the default), pushDevSchema writes a { name: 'dev', batch: -1 } row to payload_migrations. After that, payload migrate always shows the "It looks like you've run Payload in dev mode..." confirm prompt.
In a non-interactive deploy (CI runner, docker run without -it) nobody can answer it, so the deploy hangs until it times out. The documented --force-accept-warning flag doesn't help: bin/migrate.ts parses it and passes it to migrate:create and migrate:fresh, but case 'migrate' calls adapter.migrate() with no arguments, and drizzle's migrate() has no option to skip the prompt. Answering "no" calls process.exit(0), so a cancelled migration also looks like a successful deploy.
The only workaround today is deleting the dev row by hand (as suggested in #7986). I hit this on a production Next.js + Payload 3 app deployed via GitHub Actions, and #7986 / discussion #14973 describe the same thing (#14973: seeding or running int tests against a database is enough to create the row).
This is already fixed on main: cli/commands/migrate/run.ts passes forceAcceptWarning through and drizzle migrate() honors it. 3.x doesn't have the fix.
Link to the code that reproduces this issue
Reproduction Steps
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:17andnpm installnpm run migrate: applies the one committed migration (batch 1)npm run dev-boot: callsgetPayload()once in dev mode;payload_migrationsnow also containsdev | -1- Run migrations the way a deploy would:
| Command | Result (Linux node:22, and Windows 11) |
|---|---|
npm run migrate </dev/null |
Prompt is printed, process hangs (killed by timeout, exit 124) |
sleep 60 | npm run migrate (stdin open, no input) |
Hangs |
npm run migrate -- --force-accept-warning </dev/null |
Hangs, flag is ignored |
echo n | npm run migrate |
No migrations run, exit code 0 |
Which area(s) are affected?
db: postgres, db: sqlite (shared @payloadcms/drizzle code). MongoDB has no equivalent prompt.
Environment Info
payload: 3.92.0
@payloadcms/db-postgres: 3.92.0
Node.js: 22.23.4 (also 24.22.1)
PostgreSQL: 17
OS: Linux (node:22-bookworm container), Windows 11
Proposed fix (happy to open the PR)
Backport the main behavior to 3.x, without changing the default:
packages/payload/src/database/types.ts: addforceAcceptWarning?: booleanto themigrateargspackages/drizzle/src/migrate.ts: skip the prompt whenforceAcceptWarningis truepackages/payload/src/bin/migrate.ts: passforceAcceptWarningincase 'migrate'- Drizzle-only int test (seed a
batch: -1row, assertmigrateruns with the flag) + document the warning and flag under### Migrateindocs/database/migrations.mdx
Questions before I start:
- Are fixes like this still accepted on
3.xnow that v4 is in beta? - Would you also want non-interactive runs (no TTY, no flag) to fail with a non-zero exit and a message naming the
devrow and the flag, instead of hanging? I'd keep that out of the first PR unless you want it.
Related observation on main (4.0.0-beta.4)
Same repro, no TTY: without --json, payload migrate prints the prompt, then Node exits with code 13 ("Detected unsettled top-level await"). With --json it returns {"cancelled":true} with "success":true and exits 0. Not part of this issue, but mentioning it in case the non-interactive behavior is worth aligning.
Activity
irinesara commentedon Oct 28, 2026
Hi, I’d like to work on this issue. I can reproduce the non-interactive
payload migratehang and will look into backporting the--force-accept-warningbehavior to 3.x, with a focused test and documentation update. Before I start could you confirm that a 3.x fix is still welcome?anthonysantiago-eng commentedon Oct 28, 2026
Hi @irinesara, thanks for the interest! I've already opened a PR for this: #19080. It backports
--force-accept-warningto plainmigrateon 3.x, with an int test and a docs update. It's waiting on maintainer review now. If you'd like to help, testing it or reviewing it would be very welcome.