A Prisma Schema Change Has Three Lifecycles

작성자

카테고리:

← 피드로
DEV Community · LkSvn · 2026-07-23 개발(SW)
Cover image for A Prisma Schema Change Has Three Lifecycles

LkSvn

One valid PostgreSQL row refused to appear on my Next.js page.

The relationship was correct, the SQL join returned the row, and the repository compiled. At runtime, however, Prisma returned an undefined jobOpportunity relation.

The stale layer was not the database

I had changed the Prisma schema while the development server was running. That change involved three independent lifecycles:

  1. prisma migrate updates the database.
  2. prisma generate updates the TypeScript client.
  3. Restarting Next.js replaces the stale generated client held by the running process.

The first two steps were complete. The third was not.

Coming from PHP and CodeIgniter, this is an important mental-model shift. A request-scoped PHP application normally loads changed code on the next request. A long-running Node.js process can keep generated code and development caches alive.

Prisma provides valuable type safety, but it does not remove complexity—it relocates it.

My new debugging rule is simple:

  • Application edit → trust hot reload.
  • Prisma model change → migrate, generate, restart.
  • Suspicious stale behavior → clear the framework cache and restart.

Before rewriting a correct query, identify which layer is stale.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다