A running prisma dev does not apply a migration planned after contract emit; migrations/ is not watched
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, postgresql, typescript
Direzione di ricerca
Start with packages/0-framework/3-tooling/cli/src/operations/execute-dev.ts and packages/0-framework/3-tooling/cli/src/entry-resolution.ts, where the issue traces the watched-file list to firstResult.appFiles and recordAppFiles. Follow how postgres() resources expose their migration paths and how a file change triggers a rebuild. Done means planning or changing a migration under migrations/ while prisma dev runs triggers the migration to apply without restarting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Composer 0.40.0, prisma 8.0.0-rc.36, @prisma/orm-postgres 8.0.0-rc.25, macOS, Node.js 24.13.0, Bun 1.3.13. The scratch app is the one in the issue about prisma dev not moving the db ref.
Reproduced on 2026-11-30 in the same scratch app (state: two migrations applied, init and add_author), with prisma dev running in the foreground (./node_modules/.bin/prisma dev, dev: ready).
- Add
tag String?toQuoteincontract.prisma, then run./node_modules/.bin/prisma contract emit(printsstorageHash: 7f07db7a2d8ed53ccea5a0f6a663ed5cc7df39ea96808cd5ff6f225c00ddc0d7). The runningdevrebuilds at once and the rebuild's converge fails, as expected for a contract with no migration yet:
✘ rebuild 1
Converge failed; the running app is untouched and dev is still watching.
OrmMigrationError: Prisma ORM migrate (MIGRATION_PATH_NOT_FOUND): The committed migrations/ directory has no authored path from the database's current schema (68a11edd3f76d3812ccb19d59671c91e9c24b2b1dbc178f287c01668a95d1047) to the target — the deploy pipeline only replays authored migrations, it never creates schema itself. Iterating locally? Bring the database along with `prisma db update`. Shipping? Author the migration path — …
-
Plan the migration. Because of defect 1 the bare command fails, so this step names its origin:
./node_modules/.bin/prisma migration plan --name add-tag --from 20261130T0437_add_author. It writesmigrations/app/20261130T0516_add_tag(ALTER TABLE "public"."Quote" ADD COLUMN "tag" text;). -
Wait 30 seconds. The running
devprints nothing more: no rebuild starts. The column is not there:
psql "$(./node_modules/.bin/prisma dev url quotes-app.database)" -Atc "select column_name from information_schema.columns where table_name='Quote' order by 1"
author
id
text
Only a restart of prisma dev applies the migration (shown for add_author in defect 1).
Why, from source (v0.40.0): dev watches the built output and every app file the entry imports (packages/0-framework/3-tooling/cli/src/operations/execute-dev.ts lines 778-800, watchedDefinitions from firstResult.appFiles; packages/0-framework/3-tooling/cli/src/entry-resolution.ts recordAppFiles). contract.json is imported by src/data.ts, so a contract emit triggers a rebuild, which re-runs the migration step and fails because the migration is not written yet. migrations/ is never imported, so it is not watched, and the migration planned next does not trigger a rebuild. The designed loop (emit, then plan) therefore never reaches a running dev's database. Expected: a change under migrations/ of a postgres() resource also triggers a rebuild (or dev applies migrations some other way while running).
Found while writing the Composer docs on prisma.io (prisma/web#8965). The docs do not work around this.
- Lingua principale
- TypeScript
- Stelle
- 6
- Fork
- 2
- Merge medio
- 1g 2h
- PR unite (30g)
- 33
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di prisma/composer
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di prisma/composer
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
zabuton-app/meguri#875 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
iruzen-dono/workless#117 ·
I maintainer di solito rispondono entro 1 giorno
-
area:api area:web wave wave:trivial
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
vetro-protocol/vetro-monorepo#1321 ·
I maintainer di solito rispondono entro 1 giorno