Skip to content

Top 30 Prisma Interview Questions and Answers [2026]

November 18, 2026 26 min read
Prisma interview guide by Second Talent
TL;DR: Prisma interviews in 2026 test schema and relation design, safe migrations in CI, N+1 fixes, transactions under concurrency and raw SQL without injection. The current stable line is Prisma ORM 7.10.1 (October 19, 2026). Prisma ORM 8 is still a release candidate, but npm's prisma@latest tag already installs an 8.0 RC, so candidates should know how to pin version 7.

Prisma ORM 7.0.0 shipped on November 19, 2025 and made the Rust-free, TypeScript client the default: new PrismaClient() with no arguments stopped working, and every client now needs a driver adapter or an Accelerate URL.

The Prisma 7.0.0 release notes also moved the connection URL into prisma.config.ts and removed automatic .env loading.

These questions are for US hiring managers interviewing backend and full stack TypeScript engineers who own a Prisma codebase, and for engineers preparing for that loop.

Key takeaways
  1. 1Prisma 7 removed new PrismaClient() with no options. Every client needs a driver adapter or accelerateUrl, and the generated client needs an explicit output path.
  2. 2Interactive transactions default to 2,000 ms maxWait and 5,000 ms timeout. A slow external call inside one will fail the whole transaction.
  3. 3In Prisma, undefined in a filter means "no filter", so deleteMany({ where: { tenantId: undefined } }) deletes every row in the table.
  4. 4On npm, prisma@latest points to an 8.0 release candidate while @prisma/client@latest is 7.10.1. Pin both to ^7 to stay on Prisma 7.

Prisma 7 Setup and Architecture

1. What changed in Prisma 7's client architecture, and why does it matter in production?

Prisma 7 dropped the Rust query engine binary from the default client. Queries are compiled by a WebAssembly query compiler running in your Node.js process, and SQL is sent through a JavaScript database driver wrapped in a driver adapter.

The 7.0.0 release notes claim about 90% smaller bundles and up to 3x faster queries, and they removed the old library and binary engines entirely.

The production consequences a strong candidate names:

  • Connection pooling belongs to the driver now. With @prisma/adapter-pg, pool size and timeouts come from the pg pool, not from connection_limit in a URL.
  • Edge and serverless deploys get simpler. No platform-specific engine binary to bundle, which was the source of many "query engine not found" errors on Lambda and Vercel.
  • Compilation runs on the main thread. Prisma's 7.4.0 notes say compiling one query takes 0.1 ms to 1 ms and blocks the event loop, which is why 7.4.0 added a query plan cache keyed on query shape.

A weak answer says "it's faster now" and stops. A senior candidate knows the generator changed from prisma-client-js to prisma-client and that MongoDB users had to stay on Prisma 6 because 7.0 did not support it.

2. What goes in prisma.config.ts, and what moved out of schema.prisma?

Since 7.0, the CLI reads project configuration from prisma.config.ts, and the file is required for introspection and migrations.

The datasource url and shadowDatabaseUrl moved there, directUrl was removed, and the old prisma block in package.json no longer works. The schema keeps the provider, models and generator.

// prisma.config.ts
import "dotenv/config";
import { defineConfig, env } from "prisma/config";

export default defineConfig({
  schema: "prisma/schema.prisma",
  migrations: {
    path: "prisma/migrations",
    seed: "tsx prisma/seed.ts",
  },
  datasource: {
    url: env("DATABASE_URL"),
  },
});

Two details catch people. First, the CLI no longer loads .env by itself on Node.js, so the import "dotenv/config" line is required (Bun loads .env on its own).

Second, per the Prisma config reference, env() throws if the variable is missing, so a CI step that runs prisma generate without a database URL fails.

The documented fix is process.env.DATABASE_URL for commands that do not need a connection.

3. What is a driver adapter, and how do you choose one?

A driver adapter is a small package that lets Prisma Client run queries through an existing JavaScript driver. You construct it with connection details and pass it to the client.

Prisma maintains adapters such as @prisma/adapter-pg (node-postgres), @prisma/adapter-neon, @prisma/adapter-planetscale, @prisma/adapter-mariadb for MySQL and MariaDB, @prisma/adapter-better-sqlite3 and @prisma/adapter-d1 for Cloudflare D1.

import { PrismaClient } from "./generated/prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";

const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
export const prisma = new PrismaClient({ adapter });

The choice follows the runtime. A long-running Node.js API on Postgres uses adapter-pg.

A Vercel Edge or Cloudflare Worker that cannot hold TCP connections uses an HTTP or WebSocket driver such as Neon's or PlanetScale's. A good candidate also mentions that 7.0 renamed several adapter classes (for example PrismaBetterSQLite3 became PrismaBetterSqlite3), which breaks imports during an upgrade.

4. Find the bug: a Prisma 7 project that will not start.

// schema.prisma
generator client {
  provider = "prisma-client"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

// src/db.ts
import { PrismaClient } from "@prisma/client";
export const prisma = new PrismaClient();

Bugs:

  • No output on the generator. The prisma-client generator requires an output path, typically "../src/generated/prisma".
  • Wrong import. With the new generator, PrismaClient is imported from the generated folder, not from @prisma/client.
  • url in the datasource block. Prisma 7 reads the URL from prisma.config.ts.
  • No adapter. new PrismaClient() was removed. Pass { adapter }.

The follow-up that separates levels: after fixing all four, a teammate runs prisma migrate dev and the TypeScript types are stale.

Prisma 7 removed the implicit generate after migrate dev and the postinstall hook, so the build pipeline must call prisma generate explicitly.

5. How many PrismaClient instances should an app create, and what changes on serverless?

One per process. Each client owns a driver pool, so creating a client per request opens a new pool per request and exhausts Postgres connections fast.

In development with hot reload (Next.js, Vite), modules re-execute, so teams cache the client on globalThis:

import { PrismaClient } from "./generated/prisma/client";
import { PrismaPg } from "@prisma/adapter-pg";

const globalForPrisma = globalThis as unknown as { prisma?: PrismaClient };

export const prisma =
  globalForPrisma.prisma ??
  new PrismaClient({
    adapter: new PrismaPg({ connectionString: process.env.DATABASE_URL, max: 5 }),
  });

if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;

On serverless, each warm function instance holds its own pool, so 200 concurrent instances with a pool of 10 can ask for 2,000 connections.

Strong candidates size the pool small per instance, put PgBouncer or a provider pooler in front, and know that transaction-mode poolers break session features such as prepared statement reuse unless the driver is configured for it.

Prisma 7.6.0 added a statementNameGenerator option on adapter-pg for exactly this kind of prepared statement control.

Schema and Relations

6. How do you model one-to-many and many-to-many relations, and when do you make the join table explicit?

A one-to-many relation puts the foreign key scalar and a @relation on the "many" side, with a list field on the "one" side.

A many-to-many can be implicit (two list fields, Prisma manages a hidden _AToB table) or explicit (you write the join model).

model User {
  id    Int    @id @default(autoincrement())
  posts Post[]
}

model Post {
  id       Int           @id @default(autoincrement())
  authorId Int
  author   User          @relation(fields: [authorId], references: [id], onDelete: Cascade)
  tags     TagsOnPosts[]

  @@index([authorId])
}

model Tag {
  id    Int           @id @default(autoincrement())
  posts TagsOnPosts[]
}

model TagsOnPosts {
  postId     Int
  tagId      Int
  assignedAt DateTime @default(now())
  assignedBy Int
  post       Post @relation(fields: [postId], references: [id])
  tag        Tag  @relation(fields: [tagId], references: [id])

  @@id([postId, tagId])
}

Make the join table explicit as soon as the relationship carries data (who assigned the tag, when, a sort order) or when other systems query the table by name. Converting an implicit relation later means a data migration.

A strong candidate also adds @@index([authorId]) on PostgreSQL, because Postgres does not index foreign key columns automatically and the relation query will scan without it.

7. What do referential actions do, and what changes with relationMode = "prisma"?

Referential actions (onDelete and onUpdate with Cascade, Restrict, NoAction, SetNull, SetDefault) are written into the foreign key constraints that Prisma Migrate creates. The database enforces them, so a raw SQL delete cascades too.

With relationMode = "prisma" in the datasource block, Prisma creates no foreign keys and emulates the actions in the client. Teams used this on databases without foreign key support, such as older PlanetScale setups. The costs:

  • Integrity holds only for writes that go through Prisma Client. A raw SQL script or another service can leave orphan rows.
  • Emulated cascades run extra queries from the application.
  • You must add @@index on relation scalars yourself, since no foreign key index exists.

A senior candidate prefers database-enforced constraints whenever the database supports them and can explain why SetNull on a required field fails validation.

8. How do you keep Prisma model names clean while matching an existing database?

Use @map for columns, @@map for tables and native type attributes for column types. That keeps TypeScript names idiomatic (createdAt) while the database keeps created_at.

model Order {
  id        String        @id @default(uuid()) @db.Uuid
  total     Decimal       @db.Decimal(12, 2)
  status    PaymentStatus
  createdAt DateTime      @default(now()) @map("created_at") @db.Timestamptz(3)

  @@map("orders")
}

enum PaymentStatus {
  Pending  @map("pending")
  Captured @map("captured")

  @@map("payment_status")
}

Prisma 7.0 added @map on enum members, and the generated enum object now carries the mapped runtime values.

Good candidates use Decimal rather than Float for money and know Decimal values come back as Decimal.js objects, not numbers, which matters when serializing to JSON.

9. How do you add an index or constraint that Prisma's schema cannot express?

Two routes. First check whether a preview feature covers it: Prisma 7.4.0 added partial indexes behind the partialIndexes preview flag for PostgreSQL, SQLite, SQL Server and CockroachDB.

model User {
  id        Int       @id
  email     String
  deletedAt DateTime?

  @@unique([email], where: raw("\"deletedAt\" IS NULL"))
}

Otherwise, generate an empty or partial migration with prisma migrate dev --create-only, add the SQL by hand (a GIN index, an exclusion constraint, CREATE INDEX CONCURRENTLY), then apply it.

The trap is drift: an index that exists only in SQL is unknown to the schema, so later diffs may try to drop it. Prisma 7.5.0 fixed that specific problem for manual partial indexes when the preview flag is off.

A strong candidate tests that prisma migrate diff reports no changes after the manual migration.

Migrations

10. What is the difference between migrate dev, migrate deploy and db push?

  • prisma migrate dev: development only. It replays migrations into a shadow database to detect drift, generates a new SQL migration from schema changes and applies it. It can prompt to reset the database.
  • prisma migrate deploy: production and CI. It applies pending migrations from the migrations folder in order and records them in _prisma_migrations. It never generates SQL and never resets.
  • prisma db push: syncs the schema to the database with no migration file. Good for prototypes and throwaway test databases, wrong for anything with history.

The answer a hiring manager wants: production runs migrate deploy as a separate release step, before new application code takes traffic, and the migration SQL is reviewed in the pull request like code.

A weak answer runs migrate dev against staging. Prisma 7.9.0 also extended its AI-agent safety checkpoint to db push --accept-data-loss, so coding agents can no longer run it without explicit user consent.

11. You rename a column in the schema. What does Prisma generate, and how do you ship it without losing data?

Prisma Migrate cannot tell a rename from a drop plus an add, so renaming name to fullName generates DROP COLUMN "name" and ADD COLUMN "fullName", with a data loss warning. Applied as is, the data is gone.

For a quick internal tool, run migrate dev --create-only and replace the two statements with ALTER TABLE "User" RENAME COLUMN "name" TO "fullName";.

For a live API with rolling deploys, old and new code run at the same time, so use expand and contract:

  1. Add the new nullable column. Deploy code that writes both columns.
  2. Backfill old rows in batches.
  3. Deploy code that reads the new column only.
  4. Drop the old column in a later release.

Strong candidates bring up lock behavior: on large Postgres tables, adding a column with a volatile default or building an index without CONCURRENTLY can block writes.

Prisma 7.4.0 and 7.8.0 fixed issues that had blocked CREATE INDEX CONCURRENTLY in migrations.

12. What does the shadow database do, and what can go wrong with it?

migrate dev creates or uses a shadow database, replays the full migration history into it and compares the result with your schema and your dev database.

That is how it detects drift (manual changes to the dev database) and computes the next migration. migrate deploy never uses one.

Common failures: the database user lacks permission to create databases, so you set shadowDatabaseUrl in prisma.config.ts, or an old migration no longer replays cleanly because an extension is missing.

The dangerous one: pointing the shadow URL at the main database. According to the 7.10.1 release notes, migrate diff --from-migrations with that setup dropped the real schema and rebuilt it, and Prisma now refuses to run with error P3025.

A candidate who has hit this tends to remember it.

13. How do you adopt Prisma Migrate on an existing production database?

Baseline it. Introspect the schema, create an initial migration that represents the current state, and mark it as already applied so migrate deploy does not try to run it.

npx prisma db pull
mkdir -p prisma/migrations/0_init
npx prisma migrate diff \
  --from-empty \
  --to-schema prisma/schema.prisma \
  --script > prisma/migrations/0_init/migration.sql
npx prisma migrate resolve --applied 0_init

Run migrate resolve --applied 0_init against every existing environment, and let new environments run the migration normally.

Prisma 7 renamed the diff flags: --to-schema-datamodel became --to-schema, and URL-based flags were replaced by --from-config-datasource and --to-config-datasource.

Candidates who memorized Prisma 5 commands will reach for flags that no longer exist.

14. A migration failed halfway through in production. What do you do?

Prisma records the failed migration in _prisma_migrations and blocks further migrate deploy runs until you resolve it. The steps:

  1. Read the error and check what the database contains. On PostgreSQL, a migration that runs inside a transaction rolls back cleanly. On MySQL, DDL auto-commits, so some statements may have applied.
  2. If nothing applied, fix the SQL or the data, then run prisma migrate resolve --rolled-back <migration_name> and deploy again.
  3. If you finished the change by hand, run prisma migrate resolve --applied <migration_name>.

Never edit a migration file that already ran in any environment, because its checksum is stored and the history diverges.

A strong candidate adds a CI check that runs prisma migrate diff with --exit-code against a database built from the migrations, so a schema change without a migration fails the pull request.

Queries, N+1 and Performance

15. Find the N+1 problem and fix it.

const users = await prisma.user.findMany({ where: { active: true } });

for (const user of users) {
  user.posts = await prisma.post.findMany({ where: { authorId: user.id } });
}

Problem: one query for users plus one query per user. With 500 active users, that is 501 round trips.

Fixes, from the Prisma query optimization docs:

  • include: findMany({ where: { active: true }, include: { posts: true } }). With the default application-level strategy this is two SQL queries total.
  • An in filter: fetch posts with where: { authorId: { in: userIds } } and group them in memory, also two queries.
  • Database joins: relationLoadStrategy: "join" runs one query (question 17).

The GraphQL version of the problem is resolvers calling findUnique per parent.

Prisma's dataloader batches findUnique() calls made in the same tick with the same parameters and selection, so the fluent form prisma.user.findUnique({ where: { id } }).posts() batches.

The same docs state that findMany() is not batched, which is the detail most candidates miss.

16. When do you use select, include and omit?

include adds relations to the default scalar set. select lists exactly which fields and relations come back, and nested select trims relations too. omit removes named fields from the default set, which is the clean way to keep passwordHash out of every user query; it can be set per query or globally on the client.

const prisma = new PrismaClient({
  adapter,
  omit: { user: { passwordHash: true } },
});

const list = await prisma.user.findMany({
  select: { id: true, email: true, _count: { select: { posts: true } } },
});

A strong candidate selects narrowly on list endpoints (wide rows and big JSON columns cost network and memory) and uses _count instead of loading a relation to count it.

A weak candidate returns Prisma models straight from an API handler and leaks internal columns.

17. What does relationLoadStrategy do, and when would you pick "query" over "join"?

It chooses how Prisma loads relations.

Per the Prisma 7 relation queries docs, "join" uses a LATERAL JOIN on PostgreSQL or correlated subqueries on MySQL and aggregates related rows as JSON in the database, so one query comes back. "query" sends one query per table and merges in the application.

In Prisma 7 the option still requires the relationJoins preview flag and works on PostgreSQL, CockroachDB and MySQL.

const users = await prisma.user.findMany({
  relationLoadStrategy: "join",
  include: { posts: { take: 5, orderBy: { createdAt: "desc" } } },
});

Pick "query" when the database is the bottleneck and app servers have headroom, or when JSON aggregation of a wide relation costs more than two plain queries.

The docs recommend profiling, and a senior candidate would compare EXPLAIN ANALYZE output for both before changing a default.

18. Offset or cursor pagination? Write the cursor version.

Offset pagination (skip plus take) makes the database read and discard every skipped row, so page 5,000 is slow, and inserts shift rows between pages. Cursor pagination starts after a known unique value and stays fast at any depth.

async function nextPage(cursorId?: number) {
  return prisma.post.findMany({
    take: 20,
    ...(cursorId ? { skip: 1, cursor: { id: cursorId } } : {}),
    orderBy: { id: "asc" },
  });
}

skip: 1 skips the cursor row itself. The cursor must be unique and the orderBy must match it; ordering by createdAt alone breaks on ties, so order by [{ createdAt: "desc" }, { id: "desc" }] and use a compound cursor.

Cursor pagination cannot jump to page 37, which is a product question worth raising.

19. What does this code do?

async function purgeTenant(tenantId?: string) {
  const { count } = await prisma.auditLog.deleteMany({
    where: { tenantId },
  });
  return count;
}

await purgeTenant(req.body.tenantId); // body was {"tenant_id": "t_42"}

Answer: it deletes every audit log row for every tenant. The request used tenant_id, so req.body.tenantId is undefined, and Prisma treats undefined in a filter as "leave this condition out". The where becomes empty.

Fix: validate input at the boundary (Zod or similar) so tenantId is a required string before it reaches Prisma, and throw if it is missing.

Prisma also added a strictUndefinedChecks preview feature in 5.20 that throws on explicit undefined and offers Prisma.skip for intentional omission.

Candidates who have run multi-tenant systems tend to know this bug from experience; it is one of the highest-signal questions on the list.

20. Your API's p99 latency rose after upgrading to Prisma 7 under high concurrency. Where do you look?

Start with the event loop. In Prisma 7 the query compiler runs synchronously on the main thread. Prisma's 7.4.0 notes put compilation at 0.1 ms to 1 ms per query, which adds up when thousands of distinct query shapes compete.

7.4.0 added an LRU plan cache that normalizes values into placeholders, so findUnique({ where: { email } }) compiles once for every email. 7.8.0 added queryPlanCacheMaxSize to the constructor (0 disables the cache).

Then check the usual suspects: pool size per instance versus concurrency, slow SQL in the database logs, and the type of relation loading.

A strong candidate measures event loop delay (for example with perf_hooks.monitorEventLoopDelay), enables query events or OpenTelemetry tracing, and tags queries with SQL comments, which Prisma 7.1.0 added through sqlcommenter plugins, so slow statements in pg_stat_statements trace back to a route.

Transactions and Concurrency

21. Compare Prisma's transaction APIs.

Per the Prisma 7 transactions docs:

  • Nested writes (creating a user with posts in one create) run in one transaction automatically.
  • Bulk operations such as createMany, updateMany and deleteMany run as transactions.
  • Sequential $transaction([...]) takes an array of queries and runs them in order in one transaction. You cannot use the result of one inside the next.
  • Interactive $transaction(async (tx) => ...) lets you run logic between queries. Options are maxWait (default 2,000 ms), timeout (default 5,000 ms) and isolationLevel.

Isolation defaults come from the database: Read Committed on PostgreSQL and SQL Server, Repeatable Read on MySQL, Serializable on CockroachDB and SQLite.

A strong candidate keeps interactive transactions short and knows that Promise.all inside one does not run in parallel, because a transaction holds a single connection.

22. Find the bugs in this transfer function.

await prisma.$transaction(async (tx) => {
  const from = await tx.account.findUniqueOrThrow({ where: { id: fromId } });
  if (from.balance < amount) throw new Error("insufficient funds");

  await prisma.account.update({
    where: { id: fromId },
    data: { balance: from.balance - amount },
  });
  await tx.account.update({
    where: { id: toId },
    data: { balance: { increment: amount } },
  });

  await paymentsApi.notify({ fromId, toId, amount });
});

Bugs:

  • Wrong client. The debit uses prisma, not tx, so it runs outside the transaction on another connection. If the credit fails, the debit stays.
  • Lost update. It reads the balance, then writes from.balance - amount. Two concurrent transfers under Read Committed both read 100 and both write 50. Use balance: { decrement: amount } with a where that requires balance: { gte: amount }, or a row lock via raw SQL.
  • Network call inside the transaction. A slow notify holds row locks and can exceed the 5,000 ms default timeout, rolling back a transfer the partner was already told about. Move it after commit, ideally through an outbox table written in the same transaction.

23. How do you implement optimistic concurrency control with Prisma?

Add a version column, include the version you read in the update's where, and increment it in data. updateMany returns a count, so zero means someone else changed the row first.

const seat = await prisma.seat.findUniqueOrThrow({ where: { id: seatId } });
if (seat.claimedBy) throw new Error("taken");

const { count } = await prisma.seat.updateMany({
  where: { id: seatId, version: seat.version },
  data: { claimedBy: userId, version: { increment: 1 } },
});

if (count === 0) throw new ConflictError("seat changed, retry");

OCC fits when conflicts are rare and you want no locks held across user think time. When conflicts are common, the Prisma docs recommend Serializable isolation plus retrying on error P2034 (write conflict or deadlock).

A strong candidate caps retries, adds jitter and makes the operation idempotent so a retry after a timeout cannot double charge.

24. Can you nest $transaction calls? What changed in 7.5 and 7.10.1?

Since 7.5.0, yes on SQL databases.

Calling tx.$transaction(...) from inside an interactive transaction reuses the open transaction and creates a savepoint, so an inner failure can roll back to the savepoint, and an outer failure rolls back the inner work too.

Before 7.5 there was no supported nesting.

7.10.1 fixed a sharp bug in that feature. A nested call wrote the outer transaction's id into the options object you passed.

If you reused a shared constant such as TX_OPTIONS for a later top-level prisma.$transaction, that call either failed with P2028 or silently ran as a savepoint inside another request's transaction.

Senior candidates who run on 7.5 to 7.10.0 should know to upgrade or stop sharing option objects. This question tests whether a candidate reads patch notes for the libraries they own.

25. Two requests decrement stock for the same product at once. How do you prevent overselling?

Make the check and the write one atomic statement. A conditional update does both:

const { count } = await prisma.product.updateMany({
  where: { id: productId, stock: { gte: qty } },
  data: { stock: { decrement: qty } },
});
if (count === 0) throw new OutOfStockError();

The database evaluates stock >= qty and applies the decrement under its row lock, so two requests cannot both pass.

Alternatives are SELECT ... FOR UPDATE through $queryRaw inside an interactive transaction, or a CHECK (stock >= 0) constraint as a backstop that turns a race into an error instead of negative stock.

A weak answer reads stock in application code, compares, then writes, which is the lost update from question 22.

Raw SQL and TypedSQL

26. What is the difference between $queryRaw and $queryRawUnsafe?

$queryRaw is a tagged template. Each ${value} becomes a bound parameter, so user input cannot change the SQL. $queryRawUnsafe takes a plain string, and anything interpolated into it is concatenated into SQL.

The same pair exists for writes: $executeRaw and $executeRawUnsafe.

import { Prisma } from "./generated/prisma/client";

const ids = [1, 2, 3];
const rows = await prisma.$queryRaw<{ id: number; email: string }[]>`
  SELECT id, email FROM "User"
  WHERE id IN (${Prisma.join(ids)}) AND email ILIKE ${"%" + term + "%"}
`;

Prisma.sql composes fragments safely and Prisma.join expands a list into parameters. The generic on $queryRaw is only a type assertion: nothing checks that the SQL returns those columns, which is the gap TypedSQL closes.

27. How does TypedSQL work?

You write .sql files in prisma/sql, and prisma generate --sql connects to the database, infers parameter and result types, and generates a typed function per file.

Per the TypedSQL docs, it is enabled with the typedSql preview flag and needs a live database through datasource.url in prisma.config.ts.

-- prisma/sql/getUsersByAge.sql
-- @param {Int} $1:minAge
-- @param {Int} $2:maxAge
SELECT id, name, age FROM "User" WHERE age > $1 AND age < $2
import { getUsersByAge } from "./generated/prisma/sql";

const users = await prisma.$queryRawTyped(getUsersByAge(20, 30));
// users: { id: number; name: string | null; age: number | null }[]

PostgreSQL uses $1 placeholders and MySQL uses ?. File names must be valid JavaScript identifiers.

The CI implication a strong candidate raises: generating SQL types needs a database with migrations applied, so the pipeline must start one (a Postgres service container works) before prisma generate --sql.

28. Find the bugs in this sortable search endpoint.

app.get("/users", async (req, res) => {
  const { q, sort } = req.query as { q: string; sort: string };

  const byName = await prisma.$queryRawUnsafe(
    `SELECT id, email FROM "User" WHERE name LIKE '%${q}%'`
  );

  const sorted = await prisma.$queryRaw`
    SELECT id, email FROM "User" ORDER BY ${sort} DESC LIMIT 50
  `;

  res.json({ byName, sorted });
});

Bugs:

  • SQL injection. q goes straight into an unsafe string. q = "' OR '1'='1" returns every user, and worse payloads are possible. Use $queryRaw with ${`%${q}%`} as a parameter.
  • Identifiers cannot be parameters. ORDER BY ${sort} binds the string as a value, so Postgres sorts by a constant and the order is arbitrary. Map sort through an allowlist ({ email: Prisma.raw('"email"') }) and reject anything else.
  • Response serialization. If a selected column is BigInt, res.json throws, because JSON has no BigInt.

The better fix for the first query is no raw SQL at all: findMany({ where: { name: { contains: q } } }).

What Changed Recently

Nov 19, 2025
Prisma 7.0.0: Rust-free client by default, driver adapters required, prisma.config.ts required for migrations
Dec 3, 2025
Prisma 7.1.0 adds sqlcommenter plugins and query tags
Feb 11, 2026
Prisma 7.4.0 adds the query plan cache and partial indexes (preview)
Mar 11, 2026
Prisma 7.5.0 supports nested transactions through savepoints
Jul 21, 2026
Prisma 7.9.0 fixes the Prisma 7 type-check slowdown and blocks destructive commands run by AI agents
Aug 25, 2026
Prisma 7.10.0 ships @prisma/prisma7 for running 7 and 8 side by side
Oct 19, 2026
Prisma 7.10.1 fixes the nested transaction options bug and adds the P3025 shadow database guard

29. What is Prisma ORM 8, and should a team adopt it now?

Prisma 8 is a redesign developed under the working name Prisma Next.

Per the "Coming from Prisma ORM 7" guide, the schema becomes a contract file (contract.prisma, starting with // use prisma-8), the generator and datasource blocks go away, prisma contract emit replaces generate, and queries become chained calls:

// Prisma ORM 7
const users = await prisma.user.findMany({
  where: { active: true },
  select: { id: true, email: true },
  orderBy: { createdAt: "desc" },
  take: 10,
});

// Prisma ORM 8 (release candidate)
const users = await db.orm.public.User
  .where({ active: true })
  .select("id", "email")
  .orderBy((u) => u.createdAt.desc())
  .limit(10)
  .all();

The same guide lists features missing from 8, including increment and decrement, omit, $extends and connectOrCreate, and error codes such as P2002 are replaced.

The release status page says GA was expected in October 2026, and as of early November 2026 it is still at release candidate. Prisma 7 gets bug fixes and security updates for 18 months after 8 reaches GA.

A sound answer: stay on 7 for production, pin prisma and @prisma/client to ^7 because prisma@latest now installs the 8 RC, and trial 8 on a new service using the side-by-side prisma7 package from 7.10.0.

30. Prisma or Drizzle for a new TypeScript service? Give the tradeoffs.

Both are reasonable in 2026, and the right answer depends on the team. The current stable Drizzle release is 0.45.4 (October 8, 2026), with Drizzle 1.0 in release candidate.

  • Schema source. Prisma uses its own schema language and a generate step. Drizzle defines tables in TypeScript, so there is no codegen, but the schema is code that reviewers must read as code.
  • Query style. Drizzle's builder maps closely to SQL, which suits engineers who think in joins and want to predict the exact statement. Prisma's object API hides SQL and produces consistent relation loading, which suits teams with mixed SQL skill.
  • Migrations. Prisma Migrate has shadow database drift detection and a mature deploy and resolve workflow. drizzle-kit generates SQL migrations from schema diffs with fewer guardrails.
  • Runtime. Since Prisma 7 removed the engine binary, the old argument that Drizzle is lighter on edge runtimes is much weaker, though Drizzle still has fewer moving parts.
  • Roadmap risk. Prisma is moving to a new API in 8; Drizzle is approaching 1.0. Either way, a 2026 project signs up for one migration.

A strong candidate picks one for a stated reason (team SQL fluency, need for raw SQL, migration safety) and does not treat the choice as a matter of taste.

Signs of a Strong Answer

  • They know the Prisma 7 setup cold: driver adapter, generator output, prisma.config.ts, explicit prisma generate and dotenv loading.
  • They read migration SQL before merging and can ship a rename with expand and contract.
  • They spot the undefined filter trap and validate input before it reaches a where clause.
  • They use the tx client inside interactive transactions, keep network calls out, and use atomic updates or OCC instead of read, compare, write.
  • They count queries per request and can explain when "join" beats "query" for relation loading.
  • They pin Prisma versions on purpose and can explain what Prisma 8 changes before anyone upgrades.

Hiring Prisma Developers

Engineers who have run Prisma migrations against a production database, debugged connection pools on serverless and fixed a race in a transaction are rarer than résumés that list Prisma as a skill.

For the surrounding stack, see our PostgreSQL, TypeScript and NestJS interview guides.

Second Talent helps US startups hire vetted AI-Native Engineers from Asia, at $23 to $39 USD an hour billed monthly, with matches in 24 hours and a 90-day one-time replacement guarantee.

See TypeScript developers for hire and Node.js developers for hire, compare rates on the cost to hire a TypeScript developer page, or tell us what you need.

Get developers who ship with AI agents. Starts at $25/Hour.

Start Hiring $0 cost until you hire