A running prisma dev does not apply a migration planned after contract emit; migrations/ is not watched
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, postgresql, typescript
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 6
- フォーク
- 2
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 33
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
prisma/composer のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
prisma/composer の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zabuton-app/meguri#875 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
iruzen-dono/workless#117 ·
メンテナーはふだん 1 日以内に返信
-
area:api area:web wave wave:trivial
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vetro-protocol/vetro-monorepo#1321 ·
メンテナーはふだん 1 日以内に返信