A running prisma dev does not apply a migration planned after contract emit; migrations/ is not watched
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- node.js, postgresql, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 6
- Forks
- 2
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 33
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de prisma/composer
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
Todos los issues de prisma/composer
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
zabuton-app/meguri#875 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
iruzen-dono/workless#117 ·
Los mantenedores suelen responder en 1 día
-
area:api area:web wave wave:trivial
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
vetro-protocol/vetro-monorepo#1321 ·
Los mantenedores suelen responder en 1 día