[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-prisma-prisma-next-queries":3,"mdc-d8kzu-key":38,"related-repo-prisma-prisma-next-queries":3440,"related-org-prisma-prisma-next-queries":3535},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":26,"repoUrl":27,"updatedAt":28,"license":29,"forks":30,"topics":31,"repo":34,"sourceUrl":36,"mdContent":37},"prisma-next-queries","write Prisma Next queries for database operations","Write Prisma Next queries for Postgres, SQLite, or Mongo — pick a lane (Postgres\u002FSQLite `db.orm.\u003CModel>` + `db.sql.\u003Ctable>`; Mongo `db.orm.\u003Croot>` + `db.query.from(...)` pipeline builder), filter \u002F project \u002F sort \u002F paginate, eager-load with `.include(...)`, Postgres\u002FSQLite `db.transaction(...)`, Postgres\u002FSQLite ORM `.aggregate(...)`, Mongo aggregations via query builder, namespace-aware accessors (`db.orm.\u003Cns>.\u003CModel>`, `db.sql.\u003Cns>.\u003Ctable>`). Triggers: query, where, match, select, project, orderBy, take, skip, include, lookup, first, all, count, aggregate, group, create, update, delete, upsert, returning, transaction, db.close, script teardown, variant, polymorphism, drizzle-style, kysely-style. Notes: `.all()` is a Thenable (just `await` it), iterators are single-use (`RUNTIME.ITERATOR_CONSUMED`), Postgres `count` is `number` while sum\u002Favg\u002Fmin\u002Fmax are `number | null`, ranges use chained `.where()` or `and(...)` (no `.between(...)`).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"prisma","Prisma","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fprisma.png",[12,16,19,20,23],{"name":13,"slug":14,"type":15},"Next.js","next-js","tag",{"name":17,"slug":18,"type":15},"Database","database",{"name":9,"slug":8,"type":15},{"name":21,"slug":22,"type":15},"PostgreSQL","postgresql",{"name":24,"slug":25,"type":15},"SQL","sql",415,"https:\u002F\u002Fgithub.com\u002Fprisma\u002Fprisma-next","2026-07-17T05:32:03.35373",null,15,[32,33],"loggy-core","loggy-terminal",{"repoUrl":27,"stars":26,"forks":30,"topics":35,"description":29},[32,33],"https:\u002F\u002Fgithub.com\u002Fprisma\u002Fprisma-next\u002Ftree\u002FHEAD\u002Fskills\u002Fprisma-next-queries","---\nname: prisma-next-queries\ndescription: >-\n  Write Prisma Next queries for Postgres, SQLite, or Mongo — pick a lane\n  (Postgres\u002FSQLite `db.orm.\u003CModel>` + `db.sql.\u003Ctable>`; Mongo `db.orm.\u003Croot>`\n  + `db.query.from(...)` pipeline builder), filter \u002F project \u002F sort \u002F paginate,\n  eager-load with `.include(...)`, Postgres\u002FSQLite `db.transaction(...)`,\n  Postgres\u002FSQLite ORM `.aggregate(...)`, Mongo aggregations via query builder,\n  namespace-aware accessors (`db.orm.\u003Cns>.\u003CModel>`, `db.sql.\u003Cns>.\u003Ctable>`).\n  Triggers: query, where, match, select, project, orderBy, take, skip, include,\n  lookup, first, all, count, aggregate, group, create, update, delete, upsert,\n  returning, transaction, db.close, script teardown, variant, polymorphism,\n  drizzle-style, kysely-style. Notes: `.all()` is a Thenable (just `await` it),\n  iterators are single-use (`RUNTIME.ITERATOR_CONSUMED`), Postgres `count` is\n  `number` while sum\u002Favg\u002Fmin\u002Fmax are `number | null`, ranges use chained\n  `.where()` or `and(...)` (no `.between(...)`).\n---\n\n# Prisma Next — Queries\n\n> **Edit your data contract. Prisma handles the rest.**\n\nOnce the contract is emitted and the DB is up to date, this skill covers everything you do *with* the data: reading, writing, eager-loading relations, aggregating, and the choice between the ORM and the lower-level query lane.\n\n## When to Use\n\n- User wants to read, write, update, or delete data.\n- User wants to include \u002F eager-load relations.\n- User wants to paginate, sort, filter, project.\n- User wants to wrap operations in a transaction (`db.transaction(...)` — Postgres and SQLite).\n- User wants to aggregate (`count`, `sum`, `avg`, …).\n- User asks about query lanes (ORM vs SQL builder \u002F query builder).\n- User mentions: *query, select, where, orderBy, take, skip, include, eager load, first, all, count, aggregate, create, update, delete, upsert, returning, drizzle-style, kysely-style, prisma client*.\n\n## When Not to Use\n\n- User wants to add \u002F change a model → `prisma-next-contract`.\n- User wants to wire `db.ts` or add middleware → `prisma-next-runtime`.\n- User is querying through a Supabase role-bound db (`asUser` \u002F `asAnon` \u002F `asServiceRole`, RLS, `auth.*` admin reads) → `prisma-next-supabase` for the role-binding surface; everything in this skill then applies to the returned `RoleBoundDb`.\n- User wants to debug a query failure (structured error envelope) → `prisma-next-debug`.\n\n## Pick your target\n\nPrisma Next ships **two query lanes per target** on the same `db` value from `src\u002Fprisma\u002Fdb.ts`. **Before writing queries, read `db.ts` and load the matching target guide:**\n\n| Runtime import in `db.ts` | Load |\n|---|---|\n| `@prisma-next\u002Fpostgres\u002Fruntime` | [`postgres.md`](.\u002Fpostgres.md) — `db.orm.\u003CModel>` + `db.sql.\u003Ctable>` |\n| `@prisma-next\u002Fmongo\u002Fruntime` | [`mongo.md`](.\u002Fmongo.md) — `db.orm.\u003Croot>` + `db.query.from(...)` |\n| `@prisma-next\u002Fextension-supabase\u002Fruntime` | [`postgres.md`](.\u002Fpostgres.md) — a Supabase `RoleBoundDb` is a Postgres surface (`db.orm.\u003CModel>` + `db.sql.\u003Ctable>`); bind a role first via `prisma-next-supabase` |\n\nBoth targets share the contract and connection on one `db` value. Reach for the ORM first; drop to the lower-level lane when the ORM can't express the shape. Lane choice is local — one query function picks one lane, not the whole app.\n\n**Do not mix target examples.** Postgres uses PascalCase model roots (`db.orm.User`) and `db.sql.user`; Mongo uses lowercased plural roots (`db.orm.users`) and `db.query.from('users')`. There is no `db.sql` on Mongo and no `db.query` SQL-builder equivalent on Postgres.\n\n## Namespace-aware accessors\n\nWhen a contract declares more than one namespace (e.g. `public` and `auth`), models and tables are addressed by namespace coordinate:\n\n- **ORM**: `db.orm.\u003Cnamespace>.\u003CModel>` — e.g. `db.orm.public.User`, `db.orm.auth.User`\n- **SQL builder**: `db.sql.\u003Cnamespace>.\u003Ctable>` — e.g. `db.sql.public.users`, `db.sql.auth.users`\n\nThe flat `db.orm.User` \u002F `db.sql.users` form still works for single-namespace contracts (or when all table names are unique across namespaces). When the same bare name appears in more than one namespace, you must use the namespace coordinate.\n\nSee [`postgres.md` § Namespace-aware accessors](.\u002Fpostgres.md#namespace-aware-accessors) for a worked example.\n\n## Consuming the result: `await`, `.toArray()`, or `for await`\n\nCritical to get right early — on **both Postgres and Mongo**, `.all()` returns an **`AsyncIterableResult\u003CRow>`**, which is *both* a `PromiseLike\u003CRow[]>` and an `AsyncIterable\u003CRow>`. That means three consumption forms all work, and the canonical one is the shortest:\n\n```typescript\nconst users = await db.orm.User.select('id', 'email').all();\n\u002F\u002F    ^? Row[]   ← the Thenable resolves to a real array. This is the default idiom.\n```\n\nYou do **not** need a `collect()` \u002F `toArray()` helper — `await` is enough. Internally `await` invokes the result's `then(...)`, which buffers the rows into an array. Two equivalent alternatives exist for the cases where they read better:\n\n```typescript\n\u002F\u002F `.toArray()` returns a genuine `Promise\u003CRow[]>`. Reach for it only when\n\u002F\u002F something needs a real `Promise` and not merely a thenable: a slot typed\n\u002F\u002F `Promise\u003CRow[]>` (an `AsyncIterableResult` has only `then`, not `catch` \u002F\n\u002F\u002F `finally`, so it does not satisfy that annotation), or a runtime\n\u002F\u002F `instanceof Promise` check. Note that `await` and the `Promise.all` \u002F\n\u002F\u002F `Promise.race` combinators all accept the thenable directly — those are\n\u002F\u002F NOT reasons to call `.toArray()`. Whenever you are just going to await it\n\u002F\u002F here, use `await ...all()` and skip `.toArray()`.\nconst rows: Promise\u003CUser[]> = db.orm.User.select('id', 'email').all().toArray();\n\n\u002F\u002F Streaming — process rows one at a time without buffering the whole result.\n\u002F\u002F Use for genuinely large result sets (anything that wouldn't fit comfortably\n\u002F\u002F in memory) or pipelines where you can start work before all rows arrive.\nfor await (const user of db.orm.User.select('id', 'email').all()) {\n  process(user);\n}\n```\n\nTwo single-row shortcuts also exist on the result, in addition to the collection-level `.first()` (which issues `LIMIT 1` on Postgres):\n\n```typescript\nconst user = await db.orm.User.where({ id }).all().first();\n\u002F\u002F    ^? Row | null   ← buffers, returns the first row or null. Issues no LIMIT.\nconst required = await db.orm.User.where({ id }).all().firstOrThrow();\n\u002F\u002F    ^? Row          ← buffers; throws `RUNTIME.NO_ROWS` if empty.\n```\n\nFor genuine single-row reads, prefer the *collection*-level `.first()` (which adds `LIMIT 1` to the SQL on Postgres) over `.all().first()` (which fetches all rows and discards the rest). The result-level helpers are for cases where you already need the full result and want the first row without an extra round-trip.\n\n**The result is single-consumption.** Each `AsyncIterableResult` instance can be consumed once — by `await`, by `.toArray()`, or by `for await`. Trying to consume it a second time throws **`RUNTIME.ITERATOR_CONSUMED`**. The fix is almost always to store the array in a variable on first consumption and reuse the variable:\n\n```typescript\n\u002F\u002F Bad — second await throws RUNTIME.ITERATOR_CONSUMED.\nconst result = db.orm.User.select('id', 'email').all();\nconst a = await result;\nconst b = await result;\n\n\u002F\u002F Good — buffer once, reuse the array.\nconst users = await db.orm.User.select('id', 'email').all();\nconst a = users;\nconst b = users;\n```\n\nIf you've seen `collect(...)` \u002F `toArray(...)` helpers in a codebase wrapping `.all()`, they're vestigial — `await` does the same thing for free. Remove them when you touch the surrounding code.\n\n## Running queries from a short script\n\nWhen the user is running a one-off `tsx my-script.ts` (not a long-lived server), call `await db.close()` at the end so the process exits cleanly — on Postgres the façade-owned pool keeps Node's event loop alive; on Mongo the façade-owned `MongoClient` does the same. See `prisma-next-runtime` § *Running as a script (teardown)* for the full pattern including `await using`.\n\n```typescript\n\u002F\u002F src\u002Fscripts\u002Fseed.ts\nimport { db } from '..\u002Fprisma\u002Fdb';\n\n\u002F\u002F Postgres — PascalCase model root from contract\nfor (const u of users) {\n  await db.orm.User.create(u);\n}\n\n\u002F\u002F Mongo — lowercased plural root from contract (e.g. users, not User)\n\u002F\u002F for (const u of users) {\n\u002F\u002F   await db.orm.users.create(u);\n\u002F\u002F }\n\nconsole.log('Seeded.');\nawait db.close();\n```\n\n## Common Pitfalls (cross-target)\n\n1. **Using Postgres examples on a Mongo project (or vice versa).** Check `db.ts` and load the correct target guide ([`postgres.md`](.\u002Fpostgres.md) or [`mongo.md`](.\u002Fmongo.md)).\n2. **Writing a `collect()` \u002F `toArray()` helper to convert `.all()` to an array.** `.all()` returns an `AsyncIterableResult\u003CRow>` which *is* a `PromiseLike\u003CRow[]>` — `await collection.all()` directly yields `Row[]`. See *Consuming the result* above.\n3. **Consuming an `AsyncIterableResult` twice.** Each result is single-use. The second consumer throws `RUNTIME.ITERATOR_CONSUMED`. Buffer once into a variable and reuse the variable.\n\nTarget-specific pitfalls live in the per-target guides.\n\n## What Prisma Next doesn't do yet\n\n- **N:M `.include()` across a junction table.** The contract IR supports many-to-many relations with a `through` junction table, and `N:M` relations appear as valid relation names on the ORM collection. However, `.include()` on an N:M relation does not emit the two-step junction join — the query plan builder only handles the direct join columns (`localColumn` \u002F `targetColumn`) and ignores the `through` metadata. Attempting it either produces wrong results or an error. Workaround: express the N:M traversal through `db.sql.\u003Ctable>` with an explicit join on the junction table.\n- **N:M nested mutations.** `mutation-executor.ts` explicitly throws `'N:M nested mutations are not supported yet'` for nested creates\u002Flinks through an N:M relation.\n- **`and` \u002F `or` \u002F `not` combinators in the postgres façade.** The combinators currently import from `@prisma-next\u002Fsql-orm-client` (an internal package). Workaround today: import them from `@prisma-next\u002Fsql-orm-client` directly, the way the example apps do. If you want them on `@prisma-next\u002Fpostgres\u002Fruntime`, file a feature request via `prisma-next-feedback`.\n- **`.orderBy(...)` \u002F `.take(...)` on grouped aggregates (Postgres).** `db.orm.\u003CModel>.groupBy(...).aggregate(...)` materializes a `Promise\u003CArray\u003CGroup & Aggregates>>` and exposes neither ordering nor row limits at the DB layer. Result: a \"top-N groups by SUM\" query falls back to JS-side sort + slice over the full grouped result, which is fine at small cardinalities and bad at scale. Workarounds: (a) drop to `db.sql.\u003Ctable>` and write the `GROUP BY` + `ORDER BY` + `LIMIT` against the aggregated table directly; (b) live with the JS-side sort\u002Fslice if the grouped cardinality is bounded. File a feature request via `prisma-next-feedback` if this is hitting you in production.\n- **A raw-SQL lane.** Prisma Next does not currently expose a user-facing raw-SQL surface (no `db.sql.raw(...)`). Workaround: model the query through the SQL builder or — for shapes the builder can't yet express — file a feature request via `prisma-next-feedback` describing the shape so the team can decide whether to grow the builder or ship a raw lane.\n- **TypedSQL (`.sql` files compiled into typed callables).** Not implemented. Workaround: stick to the SQL builder; for repeated queries, extract a function that returns the built plan and call `db.runtime().execute(plan)` at the call site. If you want a `.sql`-file compile path, file a feature request via `prisma-next-feedback`.\n- **`EXPLAIN` \u002F query-plan inspection.** Prisma Next does not expose an `.explain()` method. Workaround: connect a `pg.Pool` you control via the runtime's `pg:` binding (see `prisma-next-runtime`) and issue `EXPLAIN ANALYZE` through it. If you want a first-class plan-inspection surface, file a feature request via `prisma-next-feedback`.\n- **Streaming large result sets.** No `.stream()` cursor today. Workaround: paginate via `.skip(n).take(m)` for moderate sizes; for very large sets, hold a `pg.Client` from the runtime's `pg:` binding and stream through it directly. If you want a built-in streaming surface, file a feature request via `prisma-next-feedback`.\n- **Multi-statement batching (Prisma-7-style `db.$transaction([call1, call2])`).** Prisma Next runs each call sequentially. Workaround: wrap atomically-related work in `db.transaction(async (tx) => { ... })` on Postgres. If you want batch-as-array semantics, file a feature request via `prisma-next-feedback`.\n- **Mongo façade transactions.** `@prisma-next\u002Fmongo\u002Fruntime` does not expose `db.transaction(...)`. Multi-document atomicity is not yet wrapped in the Prisma Next Mongo façade. Workaround: use the MongoDB driver's session API directly if you control the client binding (`mongoClient:` option). File a feature request via `prisma-next-feedback` if you need a first-class façade surface.\n- **Mongo ORM aggregates.** No `.aggregate(...)` \u002F `.groupBy(...)` on `db.orm.\u003Croot>`. Workaround: express aggregations through `db.query.from(...).group(...).build()` and `runtime.execute(plan)`.\n- **Mongo filter helpers on the façade.** Rich filters (`.in`, ranges, boolean composition) currently import from `@prisma-next\u002Fmongo-query-ast\u002Fexecution` (`MongoFieldFilter`, etc.) — not yet re-exported on `@prisma-next\u002Fmongo\u002Fruntime`. Workaround: use object equality `.where({ field: value })` where possible; import from the internal package only when necessary. Tracked alongside façade-completeness gaps in Linear `TML-2526`.\n- **Automatic N+1 detection.** Prisma Next does not warn when an `.include(...)` is missing. Workaround: be deliberate about `.include(...)` in code review; the `lints` middleware (see `prisma-next-runtime`) catches the more common authoring slips (missing `WHERE` on a `DELETE` \u002F `UPDATE`, missing `LIMIT` on a `SELECT`).\n\n## Reference Files\n\nThis skill is split for selective loading. Target-specific reference paths live in the per-target guides:\n\n- **Postgres** — [`postgres.md` § Reference Files](.\u002Fpostgres.md#reference-files)\n- **Mongo** — [`mongo.md` § Reference Files](.\u002Fmongo.md#reference-files)\n\n## Checklist\n\n- [ ] Confirmed the active target from `db.ts` and loaded the matching guide ([`postgres.md`](.\u002Fpostgres.md) or [`mongo.md`](.\u002Fmongo.md)).\n- [ ] For multi-namespace contracts, used `db.orm.\u003Cns>.\u003CModel>` \u002F `db.sql.\u003Cns>.\u003Ctable>` coordinates when the same bare name exists in more than one namespace.\n- [ ] Chose the right lane (ORM by default; lower-level builder for shapes the ORM doesn't express).\n- [ ] Used `.first()` \u002F `.first({ pk })` (Postgres) or `.where({ ... }).first()` (Mongo) for single-row reads — not `.all()`.\n- [ ] Consumed `.all()` with plain `await` (not a `collect()` \u002F `toArray()` helper). Used `for await` only when streaming is actually wanted, and never iterated the same result twice.\n- [ ] Did NOT use `db.sql` on a Mongo project or `db.query` where the Postgres SQL builder is meant.\n- [ ] Completed the target-specific checklist in the loaded guide.\n",{"data":39,"body":40},{"name":4,"description":6},{"type":41,"children":42},"root",[43,51,65,78,85,164,170,268,274,314,478,490,547,553,574,637,656,674,701,754,901,950,1354,1375,1595,1629,1679,2007,2041,2047,2097,2381,2387,2530,2535,2541,3188,3194,3199,3241,3247,3434],{"type":44,"tag":45,"props":46,"children":47},"element","h1",{"id":4},[48],{"type":49,"value":50},"text","Prisma Next — Queries",{"type":44,"tag":52,"props":53,"children":54},"blockquote",{},[55],{"type":44,"tag":56,"props":57,"children":58},"p",{},[59],{"type":44,"tag":60,"props":61,"children":62},"strong",{},[63],{"type":49,"value":64},"Edit your data contract. Prisma handles the rest.",{"type":44,"tag":56,"props":66,"children":67},{},[68,70,76],{"type":49,"value":69},"Once the contract is emitted and the DB is up to date, this skill covers everything you do ",{"type":44,"tag":71,"props":72,"children":73},"em",{},[74],{"type":49,"value":75},"with",{"type":49,"value":77}," the data: reading, writing, eager-loading relations, aggregating, and the choice between the ORM and the lower-level query lane.",{"type":44,"tag":79,"props":80,"children":82},"h2",{"id":81},"when-to-use",[83],{"type":49,"value":84},"When to Use",{"type":44,"tag":86,"props":87,"children":88},"ul",{},[89,95,100,105,119,147,152],{"type":44,"tag":90,"props":91,"children":92},"li",{},[93],{"type":49,"value":94},"User wants to read, write, update, or delete data.",{"type":44,"tag":90,"props":96,"children":97},{},[98],{"type":49,"value":99},"User wants to include \u002F eager-load relations.",{"type":44,"tag":90,"props":101,"children":102},{},[103],{"type":49,"value":104},"User wants to paginate, sort, filter, project.",{"type":44,"tag":90,"props":106,"children":107},{},[108,110,117],{"type":49,"value":109},"User wants to wrap operations in a transaction (",{"type":44,"tag":111,"props":112,"children":114},"code",{"className":113},[],[115],{"type":49,"value":116},"db.transaction(...)",{"type":49,"value":118}," — Postgres and SQLite).",{"type":44,"tag":90,"props":120,"children":121},{},[122,124,130,132,138,139,145],{"type":49,"value":123},"User wants to aggregate (",{"type":44,"tag":111,"props":125,"children":127},{"className":126},[],[128],{"type":49,"value":129},"count",{"type":49,"value":131},", ",{"type":44,"tag":111,"props":133,"children":135},{"className":134},[],[136],{"type":49,"value":137},"sum",{"type":49,"value":131},{"type":44,"tag":111,"props":140,"children":142},{"className":141},[],[143],{"type":49,"value":144},"avg",{"type":49,"value":146},", …).",{"type":44,"tag":90,"props":148,"children":149},{},[150],{"type":49,"value":151},"User asks about query lanes (ORM vs SQL builder \u002F query builder).",{"type":44,"tag":90,"props":153,"children":154},{},[155,157,162],{"type":49,"value":156},"User mentions: ",{"type":44,"tag":71,"props":158,"children":159},{},[160],{"type":49,"value":161},"query, select, where, orderBy, take, skip, include, eager load, first, all, count, aggregate, create, update, delete, upsert, returning, drizzle-style, kysely-style, prisma client",{"type":49,"value":163},".",{"type":44,"tag":79,"props":165,"children":167},{"id":166},"when-not-to-use",[168],{"type":49,"value":169},"When Not to Use",{"type":44,"tag":86,"props":171,"children":172},{},[173,185,205,256],{"type":44,"tag":90,"props":174,"children":175},{},[176,178,184],{"type":49,"value":177},"User wants to add \u002F change a model → ",{"type":44,"tag":111,"props":179,"children":181},{"className":180},[],[182],{"type":49,"value":183},"prisma-next-contract",{"type":49,"value":163},{"type":44,"tag":90,"props":186,"children":187},{},[188,190,196,198,204],{"type":49,"value":189},"User wants to wire ",{"type":44,"tag":111,"props":191,"children":193},{"className":192},[],[194],{"type":49,"value":195},"db.ts",{"type":49,"value":197}," or add middleware → ",{"type":44,"tag":111,"props":199,"children":201},{"className":200},[],[202],{"type":49,"value":203},"prisma-next-runtime",{"type":49,"value":163},{"type":44,"tag":90,"props":206,"children":207},{},[208,210,216,218,224,225,231,233,239,241,247,249,255],{"type":49,"value":209},"User is querying through a Supabase role-bound db (",{"type":44,"tag":111,"props":211,"children":213},{"className":212},[],[214],{"type":49,"value":215},"asUser",{"type":49,"value":217}," \u002F ",{"type":44,"tag":111,"props":219,"children":221},{"className":220},[],[222],{"type":49,"value":223},"asAnon",{"type":49,"value":217},{"type":44,"tag":111,"props":226,"children":228},{"className":227},[],[229],{"type":49,"value":230},"asServiceRole",{"type":49,"value":232},", RLS, ",{"type":44,"tag":111,"props":234,"children":236},{"className":235},[],[237],{"type":49,"value":238},"auth.*",{"type":49,"value":240}," admin reads) → ",{"type":44,"tag":111,"props":242,"children":244},{"className":243},[],[245],{"type":49,"value":246},"prisma-next-supabase",{"type":49,"value":248}," for the role-binding surface; everything in this skill then applies to the returned ",{"type":44,"tag":111,"props":250,"children":252},{"className":251},[],[253],{"type":49,"value":254},"RoleBoundDb",{"type":49,"value":163},{"type":44,"tag":90,"props":257,"children":258},{},[259,261,267],{"type":49,"value":260},"User wants to debug a query failure (structured error envelope) → ",{"type":44,"tag":111,"props":262,"children":264},{"className":263},[],[265],{"type":49,"value":266},"prisma-next-debug",{"type":49,"value":163},{"type":44,"tag":79,"props":269,"children":271},{"id":270},"pick-your-target",[272],{"type":49,"value":273},"Pick your target",{"type":44,"tag":56,"props":275,"children":276},{},[277,279,284,286,292,294,300,302],{"type":49,"value":278},"Prisma Next ships ",{"type":44,"tag":60,"props":280,"children":281},{},[282],{"type":49,"value":283},"two query lanes per target",{"type":49,"value":285}," on the same ",{"type":44,"tag":111,"props":287,"children":289},{"className":288},[],[290],{"type":49,"value":291},"db",{"type":49,"value":293}," value from ",{"type":44,"tag":111,"props":295,"children":297},{"className":296},[],[298],{"type":49,"value":299},"src\u002Fprisma\u002Fdb.ts",{"type":49,"value":301},". ",{"type":44,"tag":60,"props":303,"children":304},{},[305,307,312],{"type":49,"value":306},"Before writing queries, read ",{"type":44,"tag":111,"props":308,"children":310},{"className":309},[],[311],{"type":49,"value":195},{"type":49,"value":313}," and load the matching target guide:",{"type":44,"tag":315,"props":316,"children":317},"table",{},[318,342],{"type":44,"tag":319,"props":320,"children":321},"thead",{},[322],{"type":44,"tag":323,"props":324,"children":325},"tr",{},[326,337],{"type":44,"tag":327,"props":328,"children":329},"th",{},[330,332],{"type":49,"value":331},"Runtime import in ",{"type":44,"tag":111,"props":333,"children":335},{"className":334},[],[336],{"type":49,"value":195},{"type":44,"tag":327,"props":338,"children":339},{},[340],{"type":49,"value":341},"Load",{"type":44,"tag":343,"props":344,"children":345},"tbody",{},[346,389,428],{"type":44,"tag":323,"props":347,"children":348},{},[349,359],{"type":44,"tag":350,"props":351,"children":352},"td",{},[353],{"type":44,"tag":111,"props":354,"children":356},{"className":355},[],[357],{"type":49,"value":358},"@prisma-next\u002Fpostgres\u002Fruntime",{"type":44,"tag":350,"props":360,"children":361},{},[362,373,375,381,383],{"type":44,"tag":363,"props":364,"children":366},"a",{"href":365},".\u002Fpostgres.md",[367],{"type":44,"tag":111,"props":368,"children":370},{"className":369},[],[371],{"type":49,"value":372},"postgres.md",{"type":49,"value":374}," — ",{"type":44,"tag":111,"props":376,"children":378},{"className":377},[],[379],{"type":49,"value":380},"db.orm.\u003CModel>",{"type":49,"value":382}," + ",{"type":44,"tag":111,"props":384,"children":386},{"className":385},[],[387],{"type":49,"value":388},"db.sql.\u003Ctable>",{"type":44,"tag":323,"props":390,"children":391},{},[392,401],{"type":44,"tag":350,"props":393,"children":394},{},[395],{"type":44,"tag":111,"props":396,"children":398},{"className":397},[],[399],{"type":49,"value":400},"@prisma-next\u002Fmongo\u002Fruntime",{"type":44,"tag":350,"props":402,"children":403},{},[404,414,415,421,422],{"type":44,"tag":363,"props":405,"children":407},{"href":406},".\u002Fmongo.md",[408],{"type":44,"tag":111,"props":409,"children":411},{"className":410},[],[412],{"type":49,"value":413},"mongo.md",{"type":49,"value":374},{"type":44,"tag":111,"props":416,"children":418},{"className":417},[],[419],{"type":49,"value":420},"db.orm.\u003Croot>",{"type":49,"value":382},{"type":44,"tag":111,"props":423,"children":425},{"className":424},[],[426],{"type":49,"value":427},"db.query.from(...)",{"type":44,"tag":323,"props":429,"children":430},{},[431,440],{"type":44,"tag":350,"props":432,"children":433},{},[434],{"type":44,"tag":111,"props":435,"children":437},{"className":436},[],[438],{"type":49,"value":439},"@prisma-next\u002Fextension-supabase\u002Fruntime",{"type":44,"tag":350,"props":441,"children":442},{},[443,451,453,458,460,465,466,471,473],{"type":44,"tag":363,"props":444,"children":445},{"href":365},[446],{"type":44,"tag":111,"props":447,"children":449},{"className":448},[],[450],{"type":49,"value":372},{"type":49,"value":452}," — a Supabase ",{"type":44,"tag":111,"props":454,"children":456},{"className":455},[],[457],{"type":49,"value":254},{"type":49,"value":459}," is a Postgres surface (",{"type":44,"tag":111,"props":461,"children":463},{"className":462},[],[464],{"type":49,"value":380},{"type":49,"value":382},{"type":44,"tag":111,"props":467,"children":469},{"className":468},[],[470],{"type":49,"value":388},{"type":49,"value":472},"); bind a role first via ",{"type":44,"tag":111,"props":474,"children":476},{"className":475},[],[477],{"type":49,"value":246},{"type":44,"tag":56,"props":479,"children":480},{},[481,483,488],{"type":49,"value":482},"Both targets share the contract and connection on one ",{"type":44,"tag":111,"props":484,"children":486},{"className":485},[],[487],{"type":49,"value":291},{"type":49,"value":489}," value. Reach for the ORM first; drop to the lower-level lane when the ORM can't express the shape. Lane choice is local — one query function picks one lane, not the whole app.",{"type":44,"tag":56,"props":491,"children":492},{},[493,498,500,506,508,514,516,522,523,529,531,537,539,545],{"type":44,"tag":60,"props":494,"children":495},{},[496],{"type":49,"value":497},"Do not mix target examples.",{"type":49,"value":499}," Postgres uses PascalCase model roots (",{"type":44,"tag":111,"props":501,"children":503},{"className":502},[],[504],{"type":49,"value":505},"db.orm.User",{"type":49,"value":507},") and ",{"type":44,"tag":111,"props":509,"children":511},{"className":510},[],[512],{"type":49,"value":513},"db.sql.user",{"type":49,"value":515},"; Mongo uses lowercased plural roots (",{"type":44,"tag":111,"props":517,"children":519},{"className":518},[],[520],{"type":49,"value":521},"db.orm.users",{"type":49,"value":507},{"type":44,"tag":111,"props":524,"children":526},{"className":525},[],[527],{"type":49,"value":528},"db.query.from('users')",{"type":49,"value":530},". There is no ",{"type":44,"tag":111,"props":532,"children":534},{"className":533},[],[535],{"type":49,"value":536},"db.sql",{"type":49,"value":538}," on Mongo and no ",{"type":44,"tag":111,"props":540,"children":542},{"className":541},[],[543],{"type":49,"value":544},"db.query",{"type":49,"value":546}," SQL-builder equivalent on Postgres.",{"type":44,"tag":79,"props":548,"children":550},{"id":549},"namespace-aware-accessors",[551],{"type":49,"value":552},"Namespace-aware accessors",{"type":44,"tag":56,"props":554,"children":555},{},[556,558,564,566,572],{"type":49,"value":557},"When a contract declares more than one namespace (e.g. ",{"type":44,"tag":111,"props":559,"children":561},{"className":560},[],[562],{"type":49,"value":563},"public",{"type":49,"value":565}," and ",{"type":44,"tag":111,"props":567,"children":569},{"className":568},[],[570],{"type":49,"value":571},"auth",{"type":49,"value":573},"), models and tables are addressed by namespace coordinate:",{"type":44,"tag":86,"props":575,"children":576},{},[577,608],{"type":44,"tag":90,"props":578,"children":579},{},[580,585,587,593,595,601,602],{"type":44,"tag":60,"props":581,"children":582},{},[583],{"type":49,"value":584},"ORM",{"type":49,"value":586},": ",{"type":44,"tag":111,"props":588,"children":590},{"className":589},[],[591],{"type":49,"value":592},"db.orm.\u003Cnamespace>.\u003CModel>",{"type":49,"value":594}," — e.g. ",{"type":44,"tag":111,"props":596,"children":598},{"className":597},[],[599],{"type":49,"value":600},"db.orm.public.User",{"type":49,"value":131},{"type":44,"tag":111,"props":603,"children":605},{"className":604},[],[606],{"type":49,"value":607},"db.orm.auth.User",{"type":44,"tag":90,"props":609,"children":610},{},[611,616,617,623,624,630,631],{"type":44,"tag":60,"props":612,"children":613},{},[614],{"type":49,"value":615},"SQL builder",{"type":49,"value":586},{"type":44,"tag":111,"props":618,"children":620},{"className":619},[],[621],{"type":49,"value":622},"db.sql.\u003Cnamespace>.\u003Ctable>",{"type":49,"value":594},{"type":44,"tag":111,"props":625,"children":627},{"className":626},[],[628],{"type":49,"value":629},"db.sql.public.users",{"type":49,"value":131},{"type":44,"tag":111,"props":632,"children":634},{"className":633},[],[635],{"type":49,"value":636},"db.sql.auth.users",{"type":44,"tag":56,"props":638,"children":639},{},[640,642,647,648,654],{"type":49,"value":641},"The flat ",{"type":44,"tag":111,"props":643,"children":645},{"className":644},[],[646],{"type":49,"value":505},{"type":49,"value":217},{"type":44,"tag":111,"props":649,"children":651},{"className":650},[],[652],{"type":49,"value":653},"db.sql.users",{"type":49,"value":655}," form still works for single-namespace contracts (or when all table names are unique across namespaces). When the same bare name appears in more than one namespace, you must use the namespace coordinate.",{"type":44,"tag":56,"props":657,"children":658},{},[659,661,672],{"type":49,"value":660},"See ",{"type":44,"tag":363,"props":662,"children":664},{"href":663},".\u002Fpostgres.md#namespace-aware-accessors",[665,670],{"type":44,"tag":111,"props":666,"children":668},{"className":667},[],[669],{"type":49,"value":372},{"type":49,"value":671}," § Namespace-aware accessors",{"type":49,"value":673}," for a worked example.",{"type":44,"tag":79,"props":675,"children":677},{"id":676},"consuming-the-result-await-toarray-or-for-await",[678,680,686,687,693,695],{"type":49,"value":679},"Consuming the result: ",{"type":44,"tag":111,"props":681,"children":683},{"className":682},[],[684],{"type":49,"value":685},"await",{"type":49,"value":131},{"type":44,"tag":111,"props":688,"children":690},{"className":689},[],[691],{"type":49,"value":692},".toArray()",{"type":49,"value":694},", or ",{"type":44,"tag":111,"props":696,"children":698},{"className":697},[],[699],{"type":49,"value":700},"for await",{"type":44,"tag":56,"props":702,"children":703},{},[704,706,711,712,718,720,729,731,736,738,744,746,752],{"type":49,"value":705},"Critical to get right early — on ",{"type":44,"tag":60,"props":707,"children":708},{},[709],{"type":49,"value":710},"both Postgres and Mongo",{"type":49,"value":131},{"type":44,"tag":111,"props":713,"children":715},{"className":714},[],[716],{"type":49,"value":717},".all()",{"type":49,"value":719}," returns an ",{"type":44,"tag":60,"props":721,"children":722},{},[723],{"type":44,"tag":111,"props":724,"children":726},{"className":725},[],[727],{"type":49,"value":728},"AsyncIterableResult\u003CRow>",{"type":49,"value":730},", which is ",{"type":44,"tag":71,"props":732,"children":733},{},[734],{"type":49,"value":735},"both",{"type":49,"value":737}," a ",{"type":44,"tag":111,"props":739,"children":741},{"className":740},[],[742],{"type":49,"value":743},"PromiseLike\u003CRow[]>",{"type":49,"value":745}," and an ",{"type":44,"tag":111,"props":747,"children":749},{"className":748},[],[750],{"type":49,"value":751},"AsyncIterable\u003CRow>",{"type":49,"value":753},". That means three consumption forms all work, and the canonical one is the shortest:",{"type":44,"tag":755,"props":756,"children":761},"pre",{"className":757,"code":758,"language":759,"meta":760,"style":760},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const users = await db.orm.User.select('id', 'email').all();\n\u002F\u002F    ^? Row[]   ← the Thenable resolves to a real array. This is the default idiom.\n","typescript","",[762],{"type":44,"tag":111,"props":763,"children":764},{"__ignoreMap":760},[765,891],{"type":44,"tag":766,"props":767,"children":770},"span",{"class":768,"line":769},"line",1,[771,777,783,789,795,800,804,809,813,818,822,828,833,838,844,848,853,858,863,867,872,876,881,886],{"type":44,"tag":766,"props":772,"children":774},{"style":773},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[775],{"type":49,"value":776},"const",{"type":44,"tag":766,"props":778,"children":780},{"style":779},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[781],{"type":49,"value":782}," users ",{"type":44,"tag":766,"props":784,"children":786},{"style":785},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[787],{"type":49,"value":788},"=",{"type":44,"tag":766,"props":790,"children":792},{"style":791},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[793],{"type":49,"value":794}," await",{"type":44,"tag":766,"props":796,"children":797},{"style":779},[798],{"type":49,"value":799}," db",{"type":44,"tag":766,"props":801,"children":802},{"style":785},[803],{"type":49,"value":163},{"type":44,"tag":766,"props":805,"children":806},{"style":779},[807],{"type":49,"value":808},"orm",{"type":44,"tag":766,"props":810,"children":811},{"style":785},[812],{"type":49,"value":163},{"type":44,"tag":766,"props":814,"children":815},{"style":779},[816],{"type":49,"value":817},"User",{"type":44,"tag":766,"props":819,"children":820},{"style":785},[821],{"type":49,"value":163},{"type":44,"tag":766,"props":823,"children":825},{"style":824},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[826],{"type":49,"value":827},"select",{"type":44,"tag":766,"props":829,"children":830},{"style":779},[831],{"type":49,"value":832},"(",{"type":44,"tag":766,"props":834,"children":835},{"style":785},[836],{"type":49,"value":837},"'",{"type":44,"tag":766,"props":839,"children":841},{"style":840},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[842],{"type":49,"value":843},"id",{"type":44,"tag":766,"props":845,"children":846},{"style":785},[847],{"type":49,"value":837},{"type":44,"tag":766,"props":849,"children":850},{"style":785},[851],{"type":49,"value":852},",",{"type":44,"tag":766,"props":854,"children":855},{"style":785},[856],{"type":49,"value":857}," '",{"type":44,"tag":766,"props":859,"children":860},{"style":840},[861],{"type":49,"value":862},"email",{"type":44,"tag":766,"props":864,"children":865},{"style":785},[866],{"type":49,"value":837},{"type":44,"tag":766,"props":868,"children":869},{"style":779},[870],{"type":49,"value":871},")",{"type":44,"tag":766,"props":873,"children":874},{"style":785},[875],{"type":49,"value":163},{"type":44,"tag":766,"props":877,"children":878},{"style":824},[879],{"type":49,"value":880},"all",{"type":44,"tag":766,"props":882,"children":883},{"style":779},[884],{"type":49,"value":885},"()",{"type":44,"tag":766,"props":887,"children":888},{"style":785},[889],{"type":49,"value":890},";\n",{"type":44,"tag":766,"props":892,"children":894},{"class":768,"line":893},2,[895],{"type":44,"tag":766,"props":896,"children":898},{"style":897},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[899],{"type":49,"value":900},"\u002F\u002F    ^? Row[]   ← the Thenable resolves to a real array. This is the default idiom.\n",{"type":44,"tag":56,"props":902,"children":903},{},[904,906,911,913,919,920,926,928,933,935,940,942,948],{"type":49,"value":905},"You do ",{"type":44,"tag":60,"props":907,"children":908},{},[909],{"type":49,"value":910},"not",{"type":49,"value":912}," need a ",{"type":44,"tag":111,"props":914,"children":916},{"className":915},[],[917],{"type":49,"value":918},"collect()",{"type":49,"value":217},{"type":44,"tag":111,"props":921,"children":923},{"className":922},[],[924],{"type":49,"value":925},"toArray()",{"type":49,"value":927}," helper — ",{"type":44,"tag":111,"props":929,"children":931},{"className":930},[],[932],{"type":49,"value":685},{"type":49,"value":934}," is enough. Internally ",{"type":44,"tag":111,"props":936,"children":938},{"className":937},[],[939],{"type":49,"value":685},{"type":49,"value":941}," invokes the result's ",{"type":44,"tag":111,"props":943,"children":945},{"className":944},[],[946],{"type":49,"value":947},"then(...)",{"type":49,"value":949},", which buffers the rows into an array. Two equivalent alternatives exist for the cases where they read better:",{"type":44,"tag":755,"props":951,"children":953},{"className":757,"code":952,"language":759,"meta":760,"style":760},"\u002F\u002F `.toArray()` returns a genuine `Promise\u003CRow[]>`. Reach for it only when\n\u002F\u002F something needs a real `Promise` and not merely a thenable: a slot typed\n\u002F\u002F `Promise\u003CRow[]>` (an `AsyncIterableResult` has only `then`, not `catch` \u002F\n\u002F\u002F `finally`, so it does not satisfy that annotation), or a runtime\n\u002F\u002F `instanceof Promise` check. Note that `await` and the `Promise.all` \u002F\n\u002F\u002F `Promise.race` combinators all accept the thenable directly — those are\n\u002F\u002F NOT reasons to call `.toArray()`. Whenever you are just going to await it\n\u002F\u002F here, use `await ...all()` and skip `.toArray()`.\nconst rows: Promise\u003CUser[]> = db.orm.User.select('id', 'email').all().toArray();\n\n\u002F\u002F Streaming — process rows one at a time without buffering the whole result.\n\u002F\u002F Use for genuinely large result sets (anything that wouldn't fit comfortably\n\u002F\u002F in memory) or pipelines where you can start work before all rows arrive.\nfor await (const user of db.orm.User.select('id', 'email').all()) {\n  process(user);\n}\n",[954],{"type":44,"tag":111,"props":955,"children":956},{"__ignoreMap":760},[957,965,973,982,991,1000,1009,1018,1027,1168,1178,1187,1196,1205,1319,1345],{"type":44,"tag":766,"props":958,"children":959},{"class":768,"line":769},[960],{"type":44,"tag":766,"props":961,"children":962},{"style":897},[963],{"type":49,"value":964},"\u002F\u002F `.toArray()` returns a genuine `Promise\u003CRow[]>`. Reach for it only when\n",{"type":44,"tag":766,"props":966,"children":967},{"class":768,"line":893},[968],{"type":44,"tag":766,"props":969,"children":970},{"style":897},[971],{"type":49,"value":972},"\u002F\u002F something needs a real `Promise` and not merely a thenable: a slot typed\n",{"type":44,"tag":766,"props":974,"children":976},{"class":768,"line":975},3,[977],{"type":44,"tag":766,"props":978,"children":979},{"style":897},[980],{"type":49,"value":981},"\u002F\u002F `Promise\u003CRow[]>` (an `AsyncIterableResult` has only `then`, not `catch` \u002F\n",{"type":44,"tag":766,"props":983,"children":985},{"class":768,"line":984},4,[986],{"type":44,"tag":766,"props":987,"children":988},{"style":897},[989],{"type":49,"value":990},"\u002F\u002F `finally`, so it does not satisfy that annotation), or a runtime\n",{"type":44,"tag":766,"props":992,"children":994},{"class":768,"line":993},5,[995],{"type":44,"tag":766,"props":996,"children":997},{"style":897},[998],{"type":49,"value":999},"\u002F\u002F `instanceof Promise` check. Note that `await` and the `Promise.all` \u002F\n",{"type":44,"tag":766,"props":1001,"children":1003},{"class":768,"line":1002},6,[1004],{"type":44,"tag":766,"props":1005,"children":1006},{"style":897},[1007],{"type":49,"value":1008},"\u002F\u002F `Promise.race` combinators all accept the thenable directly — those are\n",{"type":44,"tag":766,"props":1010,"children":1012},{"class":768,"line":1011},7,[1013],{"type":44,"tag":766,"props":1014,"children":1015},{"style":897},[1016],{"type":49,"value":1017},"\u002F\u002F NOT reasons to call `.toArray()`. Whenever you are just going to await it\n",{"type":44,"tag":766,"props":1019,"children":1021},{"class":768,"line":1020},8,[1022],{"type":44,"tag":766,"props":1023,"children":1024},{"style":897},[1025],{"type":49,"value":1026},"\u002F\u002F here, use `await ...all()` and skip `.toArray()`.\n",{"type":44,"tag":766,"props":1028,"children":1030},{"class":768,"line":1029},9,[1031,1035,1040,1045,1051,1056,1060,1065,1070,1075,1079,1083,1087,1091,1095,1099,1103,1107,1111,1115,1119,1123,1127,1131,1135,1139,1143,1147,1151,1155,1160,1164],{"type":44,"tag":766,"props":1032,"children":1033},{"style":773},[1034],{"type":49,"value":776},{"type":44,"tag":766,"props":1036,"children":1037},{"style":779},[1038],{"type":49,"value":1039}," rows",{"type":44,"tag":766,"props":1041,"children":1042},{"style":785},[1043],{"type":49,"value":1044},":",{"type":44,"tag":766,"props":1046,"children":1048},{"style":1047},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1049],{"type":49,"value":1050}," Promise",{"type":44,"tag":766,"props":1052,"children":1053},{"style":785},[1054],{"type":49,"value":1055},"\u003C",{"type":44,"tag":766,"props":1057,"children":1058},{"style":1047},[1059],{"type":49,"value":817},{"type":44,"tag":766,"props":1061,"children":1062},{"style":779},[1063],{"type":49,"value":1064},"[]",{"type":44,"tag":766,"props":1066,"children":1067},{"style":785},[1068],{"type":49,"value":1069},">",{"type":44,"tag":766,"props":1071,"children":1072},{"style":785},[1073],{"type":49,"value":1074}," =",{"type":44,"tag":766,"props":1076,"children":1077},{"style":779},[1078],{"type":49,"value":799},{"type":44,"tag":766,"props":1080,"children":1081},{"style":785},[1082],{"type":49,"value":163},{"type":44,"tag":766,"props":1084,"children":1085},{"style":779},[1086],{"type":49,"value":808},{"type":44,"tag":766,"props":1088,"children":1089},{"style":785},[1090],{"type":49,"value":163},{"type":44,"tag":766,"props":1092,"children":1093},{"style":779},[1094],{"type":49,"value":817},{"type":44,"tag":766,"props":1096,"children":1097},{"style":785},[1098],{"type":49,"value":163},{"type":44,"tag":766,"props":1100,"children":1101},{"style":824},[1102],{"type":49,"value":827},{"type":44,"tag":766,"props":1104,"children":1105},{"style":779},[1106],{"type":49,"value":832},{"type":44,"tag":766,"props":1108,"children":1109},{"style":785},[1110],{"type":49,"value":837},{"type":44,"tag":766,"props":1112,"children":1113},{"style":840},[1114],{"type":49,"value":843},{"type":44,"tag":766,"props":1116,"children":1117},{"style":785},[1118],{"type":49,"value":837},{"type":44,"tag":766,"props":1120,"children":1121},{"style":785},[1122],{"type":49,"value":852},{"type":44,"tag":766,"props":1124,"children":1125},{"style":785},[1126],{"type":49,"value":857},{"type":44,"tag":766,"props":1128,"children":1129},{"style":840},[1130],{"type":49,"value":862},{"type":44,"tag":766,"props":1132,"children":1133},{"style":785},[1134],{"type":49,"value":837},{"type":44,"tag":766,"props":1136,"children":1137},{"style":779},[1138],{"type":49,"value":871},{"type":44,"tag":766,"props":1140,"children":1141},{"style":785},[1142],{"type":49,"value":163},{"type":44,"tag":766,"props":1144,"children":1145},{"style":824},[1146],{"type":49,"value":880},{"type":44,"tag":766,"props":1148,"children":1149},{"style":779},[1150],{"type":49,"value":885},{"type":44,"tag":766,"props":1152,"children":1153},{"style":785},[1154],{"type":49,"value":163},{"type":44,"tag":766,"props":1156,"children":1157},{"style":824},[1158],{"type":49,"value":1159},"toArray",{"type":44,"tag":766,"props":1161,"children":1162},{"style":779},[1163],{"type":49,"value":885},{"type":44,"tag":766,"props":1165,"children":1166},{"style":785},[1167],{"type":49,"value":890},{"type":44,"tag":766,"props":1169,"children":1171},{"class":768,"line":1170},10,[1172],{"type":44,"tag":766,"props":1173,"children":1175},{"emptyLinePlaceholder":1174},true,[1176],{"type":49,"value":1177},"\n",{"type":44,"tag":766,"props":1179,"children":1181},{"class":768,"line":1180},11,[1182],{"type":44,"tag":766,"props":1183,"children":1184},{"style":897},[1185],{"type":49,"value":1186},"\u002F\u002F Streaming — process rows one at a time without buffering the whole result.\n",{"type":44,"tag":766,"props":1188,"children":1190},{"class":768,"line":1189},12,[1191],{"type":44,"tag":766,"props":1192,"children":1193},{"style":897},[1194],{"type":49,"value":1195},"\u002F\u002F Use for genuinely large result sets (anything that wouldn't fit comfortably\n",{"type":44,"tag":766,"props":1197,"children":1199},{"class":768,"line":1198},13,[1200],{"type":44,"tag":766,"props":1201,"children":1202},{"style":897},[1203],{"type":49,"value":1204},"\u002F\u002F in memory) or pipelines where you can start work before all rows arrive.\n",{"type":44,"tag":766,"props":1206,"children":1208},{"class":768,"line":1207},14,[1209,1214,1218,1223,1227,1232,1237,1241,1245,1249,1253,1257,1261,1265,1269,1273,1277,1281,1285,1289,1293,1297,1301,1305,1309,1314],{"type":44,"tag":766,"props":1210,"children":1211},{"style":791},[1212],{"type":49,"value":1213},"for",{"type":44,"tag":766,"props":1215,"children":1216},{"style":791},[1217],{"type":49,"value":794},{"type":44,"tag":766,"props":1219,"children":1220},{"style":779},[1221],{"type":49,"value":1222}," (",{"type":44,"tag":766,"props":1224,"children":1225},{"style":773},[1226],{"type":49,"value":776},{"type":44,"tag":766,"props":1228,"children":1229},{"style":779},[1230],{"type":49,"value":1231}," user ",{"type":44,"tag":766,"props":1233,"children":1234},{"style":785},[1235],{"type":49,"value":1236},"of",{"type":44,"tag":766,"props":1238,"children":1239},{"style":779},[1240],{"type":49,"value":799},{"type":44,"tag":766,"props":1242,"children":1243},{"style":785},[1244],{"type":49,"value":163},{"type":44,"tag":766,"props":1246,"children":1247},{"style":779},[1248],{"type":49,"value":808},{"type":44,"tag":766,"props":1250,"children":1251},{"style":785},[1252],{"type":49,"value":163},{"type":44,"tag":766,"props":1254,"children":1255},{"style":779},[1256],{"type":49,"value":817},{"type":44,"tag":766,"props":1258,"children":1259},{"style":785},[1260],{"type":49,"value":163},{"type":44,"tag":766,"props":1262,"children":1263},{"style":824},[1264],{"type":49,"value":827},{"type":44,"tag":766,"props":1266,"children":1267},{"style":779},[1268],{"type":49,"value":832},{"type":44,"tag":766,"props":1270,"children":1271},{"style":785},[1272],{"type":49,"value":837},{"type":44,"tag":766,"props":1274,"children":1275},{"style":840},[1276],{"type":49,"value":843},{"type":44,"tag":766,"props":1278,"children":1279},{"style":785},[1280],{"type":49,"value":837},{"type":44,"tag":766,"props":1282,"children":1283},{"style":785},[1284],{"type":49,"value":852},{"type":44,"tag":766,"props":1286,"children":1287},{"style":785},[1288],{"type":49,"value":857},{"type":44,"tag":766,"props":1290,"children":1291},{"style":840},[1292],{"type":49,"value":862},{"type":44,"tag":766,"props":1294,"children":1295},{"style":785},[1296],{"type":49,"value":837},{"type":44,"tag":766,"props":1298,"children":1299},{"style":779},[1300],{"type":49,"value":871},{"type":44,"tag":766,"props":1302,"children":1303},{"style":785},[1304],{"type":49,"value":163},{"type":44,"tag":766,"props":1306,"children":1307},{"style":824},[1308],{"type":49,"value":880},{"type":44,"tag":766,"props":1310,"children":1311},{"style":779},[1312],{"type":49,"value":1313},"()) ",{"type":44,"tag":766,"props":1315,"children":1316},{"style":785},[1317],{"type":49,"value":1318},"{\n",{"type":44,"tag":766,"props":1320,"children":1321},{"class":768,"line":30},[1322,1327,1332,1337,1341],{"type":44,"tag":766,"props":1323,"children":1324},{"style":824},[1325],{"type":49,"value":1326},"  process",{"type":44,"tag":766,"props":1328,"children":1330},{"style":1329},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[1331],{"type":49,"value":832},{"type":44,"tag":766,"props":1333,"children":1334},{"style":779},[1335],{"type":49,"value":1336},"user",{"type":44,"tag":766,"props":1338,"children":1339},{"style":1329},[1340],{"type":49,"value":871},{"type":44,"tag":766,"props":1342,"children":1343},{"style":785},[1344],{"type":49,"value":890},{"type":44,"tag":766,"props":1346,"children":1348},{"class":768,"line":1347},16,[1349],{"type":44,"tag":766,"props":1350,"children":1351},{"style":785},[1352],{"type":49,"value":1353},"}\n",{"type":44,"tag":56,"props":1355,"children":1356},{},[1357,1359,1365,1367,1373],{"type":49,"value":1358},"Two single-row shortcuts also exist on the result, in addition to the collection-level ",{"type":44,"tag":111,"props":1360,"children":1362},{"className":1361},[],[1363],{"type":49,"value":1364},".first()",{"type":49,"value":1366}," (which issues ",{"type":44,"tag":111,"props":1368,"children":1370},{"className":1369},[],[1371],{"type":49,"value":1372},"LIMIT 1",{"type":49,"value":1374}," on Postgres):",{"type":44,"tag":755,"props":1376,"children":1378},{"className":757,"code":1377,"language":759,"meta":760,"style":760},"const user = await db.orm.User.where({ id }).all().first();\n\u002F\u002F    ^? Row | null   ← buffers, returns the first row or null. Issues no LIMIT.\nconst required = await db.orm.User.where({ id }).all().firstOrThrow();\n\u002F\u002F    ^? Row          ← buffers; throws `RUNTIME.NO_ROWS` if empty.\n",[1379],{"type":44,"tag":111,"props":1380,"children":1381},{"__ignoreMap":760},[1382,1482,1490,1587],{"type":44,"tag":766,"props":1383,"children":1384},{"class":768,"line":769},[1385,1389,1393,1397,1401,1405,1409,1413,1417,1421,1425,1430,1434,1439,1444,1449,1453,1457,1461,1465,1469,1474,1478],{"type":44,"tag":766,"props":1386,"children":1387},{"style":773},[1388],{"type":49,"value":776},{"type":44,"tag":766,"props":1390,"children":1391},{"style":779},[1392],{"type":49,"value":1231},{"type":44,"tag":766,"props":1394,"children":1395},{"style":785},[1396],{"type":49,"value":788},{"type":44,"tag":766,"props":1398,"children":1399},{"style":791},[1400],{"type":49,"value":794},{"type":44,"tag":766,"props":1402,"children":1403},{"style":779},[1404],{"type":49,"value":799},{"type":44,"tag":766,"props":1406,"children":1407},{"style":785},[1408],{"type":49,"value":163},{"type":44,"tag":766,"props":1410,"children":1411},{"style":779},[1412],{"type":49,"value":808},{"type":44,"tag":766,"props":1414,"children":1415},{"style":785},[1416],{"type":49,"value":163},{"type":44,"tag":766,"props":1418,"children":1419},{"style":779},[1420],{"type":49,"value":817},{"type":44,"tag":766,"props":1422,"children":1423},{"style":785},[1424],{"type":49,"value":163},{"type":44,"tag":766,"props":1426,"children":1427},{"style":824},[1428],{"type":49,"value":1429},"where",{"type":44,"tag":766,"props":1431,"children":1432},{"style":779},[1433],{"type":49,"value":832},{"type":44,"tag":766,"props":1435,"children":1436},{"style":785},[1437],{"type":49,"value":1438},"{",{"type":44,"tag":766,"props":1440,"children":1441},{"style":779},[1442],{"type":49,"value":1443}," id ",{"type":44,"tag":766,"props":1445,"children":1446},{"style":785},[1447],{"type":49,"value":1448},"}",{"type":44,"tag":766,"props":1450,"children":1451},{"style":779},[1452],{"type":49,"value":871},{"type":44,"tag":766,"props":1454,"children":1455},{"style":785},[1456],{"type":49,"value":163},{"type":44,"tag":766,"props":1458,"children":1459},{"style":824},[1460],{"type":49,"value":880},{"type":44,"tag":766,"props":1462,"children":1463},{"style":779},[1464],{"type":49,"value":885},{"type":44,"tag":766,"props":1466,"children":1467},{"style":785},[1468],{"type":49,"value":163},{"type":44,"tag":766,"props":1470,"children":1471},{"style":824},[1472],{"type":49,"value":1473},"first",{"type":44,"tag":766,"props":1475,"children":1476},{"style":779},[1477],{"type":49,"value":885},{"type":44,"tag":766,"props":1479,"children":1480},{"style":785},[1481],{"type":49,"value":890},{"type":44,"tag":766,"props":1483,"children":1484},{"class":768,"line":893},[1485],{"type":44,"tag":766,"props":1486,"children":1487},{"style":897},[1488],{"type":49,"value":1489},"\u002F\u002F    ^? Row | null   ← buffers, returns the first row or null. Issues no LIMIT.\n",{"type":44,"tag":766,"props":1491,"children":1492},{"class":768,"line":975},[1493,1497,1502,1506,1510,1514,1518,1522,1526,1530,1534,1538,1542,1546,1550,1554,1558,1562,1566,1570,1574,1579,1583],{"type":44,"tag":766,"props":1494,"children":1495},{"style":773},[1496],{"type":49,"value":776},{"type":44,"tag":766,"props":1498,"children":1499},{"style":779},[1500],{"type":49,"value":1501}," required ",{"type":44,"tag":766,"props":1503,"children":1504},{"style":785},[1505],{"type":49,"value":788},{"type":44,"tag":766,"props":1507,"children":1508},{"style":791},[1509],{"type":49,"value":794},{"type":44,"tag":766,"props":1511,"children":1512},{"style":779},[1513],{"type":49,"value":799},{"type":44,"tag":766,"props":1515,"children":1516},{"style":785},[1517],{"type":49,"value":163},{"type":44,"tag":766,"props":1519,"children":1520},{"style":779},[1521],{"type":49,"value":808},{"type":44,"tag":766,"props":1523,"children":1524},{"style":785},[1525],{"type":49,"value":163},{"type":44,"tag":766,"props":1527,"children":1528},{"style":779},[1529],{"type":49,"value":817},{"type":44,"tag":766,"props":1531,"children":1532},{"style":785},[1533],{"type":49,"value":163},{"type":44,"tag":766,"props":1535,"children":1536},{"style":824},[1537],{"type":49,"value":1429},{"type":44,"tag":766,"props":1539,"children":1540},{"style":779},[1541],{"type":49,"value":832},{"type":44,"tag":766,"props":1543,"children":1544},{"style":785},[1545],{"type":49,"value":1438},{"type":44,"tag":766,"props":1547,"children":1548},{"style":779},[1549],{"type":49,"value":1443},{"type":44,"tag":766,"props":1551,"children":1552},{"style":785},[1553],{"type":49,"value":1448},{"type":44,"tag":766,"props":1555,"children":1556},{"style":779},[1557],{"type":49,"value":871},{"type":44,"tag":766,"props":1559,"children":1560},{"style":785},[1561],{"type":49,"value":163},{"type":44,"tag":766,"props":1563,"children":1564},{"style":824},[1565],{"type":49,"value":880},{"type":44,"tag":766,"props":1567,"children":1568},{"style":779},[1569],{"type":49,"value":885},{"type":44,"tag":766,"props":1571,"children":1572},{"style":785},[1573],{"type":49,"value":163},{"type":44,"tag":766,"props":1575,"children":1576},{"style":824},[1577],{"type":49,"value":1578},"firstOrThrow",{"type":44,"tag":766,"props":1580,"children":1581},{"style":779},[1582],{"type":49,"value":885},{"type":44,"tag":766,"props":1584,"children":1585},{"style":785},[1586],{"type":49,"value":890},{"type":44,"tag":766,"props":1588,"children":1589},{"class":768,"line":984},[1590],{"type":44,"tag":766,"props":1591,"children":1592},{"style":897},[1593],{"type":49,"value":1594},"\u002F\u002F    ^? Row          ← buffers; throws `RUNTIME.NO_ROWS` if empty.\n",{"type":44,"tag":56,"props":1596,"children":1597},{},[1598,1600,1605,1607,1612,1614,1619,1621,1627],{"type":49,"value":1599},"For genuine single-row reads, prefer the ",{"type":44,"tag":71,"props":1601,"children":1602},{},[1603],{"type":49,"value":1604},"collection",{"type":49,"value":1606},"-level ",{"type":44,"tag":111,"props":1608,"children":1610},{"className":1609},[],[1611],{"type":49,"value":1364},{"type":49,"value":1613}," (which adds ",{"type":44,"tag":111,"props":1615,"children":1617},{"className":1616},[],[1618],{"type":49,"value":1372},{"type":49,"value":1620}," to the SQL on Postgres) over ",{"type":44,"tag":111,"props":1622,"children":1624},{"className":1623},[],[1625],{"type":49,"value":1626},".all().first()",{"type":49,"value":1628}," (which fetches all rows and discards the rest). The result-level helpers are for cases where you already need the full result and want the first row without an extra round-trip.",{"type":44,"tag":56,"props":1630,"children":1631},{},[1632,1637,1639,1645,1647,1652,1654,1659,1661,1666,1668,1677],{"type":44,"tag":60,"props":1633,"children":1634},{},[1635],{"type":49,"value":1636},"The result is single-consumption.",{"type":49,"value":1638}," Each ",{"type":44,"tag":111,"props":1640,"children":1642},{"className":1641},[],[1643],{"type":49,"value":1644},"AsyncIterableResult",{"type":49,"value":1646}," instance can be consumed once — by ",{"type":44,"tag":111,"props":1648,"children":1650},{"className":1649},[],[1651],{"type":49,"value":685},{"type":49,"value":1653},", by ",{"type":44,"tag":111,"props":1655,"children":1657},{"className":1656},[],[1658],{"type":49,"value":692},{"type":49,"value":1660},", or by ",{"type":44,"tag":111,"props":1662,"children":1664},{"className":1663},[],[1665],{"type":49,"value":700},{"type":49,"value":1667},". Trying to consume it a second time throws ",{"type":44,"tag":60,"props":1669,"children":1670},{},[1671],{"type":44,"tag":111,"props":1672,"children":1674},{"className":1673},[],[1675],{"type":49,"value":1676},"RUNTIME.ITERATOR_CONSUMED",{"type":49,"value":1678},". The fix is almost always to store the array in a variable on first consumption and reuse the variable:",{"type":44,"tag":755,"props":1680,"children":1682},{"className":757,"code":1681,"language":759,"meta":760,"style":760},"\u002F\u002F Bad — second await throws RUNTIME.ITERATOR_CONSUMED.\nconst result = db.orm.User.select('id', 'email').all();\nconst a = await result;\nconst b = await result;\n\n\u002F\u002F Good — buffer once, reuse the array.\nconst users = await db.orm.User.select('id', 'email').all();\nconst a = users;\nconst b = users;\n",[1683],{"type":44,"tag":111,"props":1684,"children":1685},{"__ignoreMap":760},[1686,1694,1790,1818,1846,1853,1861,1960,1984],{"type":44,"tag":766,"props":1687,"children":1688},{"class":768,"line":769},[1689],{"type":44,"tag":766,"props":1690,"children":1691},{"style":897},[1692],{"type":49,"value":1693},"\u002F\u002F Bad — second await throws RUNTIME.ITERATOR_CONSUMED.\n",{"type":44,"tag":766,"props":1695,"children":1696},{"class":768,"line":893},[1697,1701,1706,1710,1714,1718,1722,1726,1730,1734,1738,1742,1746,1750,1754,1758,1762,1766,1770,1774,1778,1782,1786],{"type":44,"tag":766,"props":1698,"children":1699},{"style":773},[1700],{"type":49,"value":776},{"type":44,"tag":766,"props":1702,"children":1703},{"style":779},[1704],{"type":49,"value":1705}," result ",{"type":44,"tag":766,"props":1707,"children":1708},{"style":785},[1709],{"type":49,"value":788},{"type":44,"tag":766,"props":1711,"children":1712},{"style":779},[1713],{"type":49,"value":799},{"type":44,"tag":766,"props":1715,"children":1716},{"style":785},[1717],{"type":49,"value":163},{"type":44,"tag":766,"props":1719,"children":1720},{"style":779},[1721],{"type":49,"value":808},{"type":44,"tag":766,"props":1723,"children":1724},{"style":785},[1725],{"type":49,"value":163},{"type":44,"tag":766,"props":1727,"children":1728},{"style":779},[1729],{"type":49,"value":817},{"type":44,"tag":766,"props":1731,"children":1732},{"style":785},[1733],{"type":49,"value":163},{"type":44,"tag":766,"props":1735,"children":1736},{"style":824},[1737],{"type":49,"value":827},{"type":44,"tag":766,"props":1739,"children":1740},{"style":779},[1741],{"type":49,"value":832},{"type":44,"tag":766,"props":1743,"children":1744},{"style":785},[1745],{"type":49,"value":837},{"type":44,"tag":766,"props":1747,"children":1748},{"style":840},[1749],{"type":49,"value":843},{"type":44,"tag":766,"props":1751,"children":1752},{"style":785},[1753],{"type":49,"value":837},{"type":44,"tag":766,"props":1755,"children":1756},{"style":785},[1757],{"type":49,"value":852},{"type":44,"tag":766,"props":1759,"children":1760},{"style":785},[1761],{"type":49,"value":857},{"type":44,"tag":766,"props":1763,"children":1764},{"style":840},[1765],{"type":49,"value":862},{"type":44,"tag":766,"props":1767,"children":1768},{"style":785},[1769],{"type":49,"value":837},{"type":44,"tag":766,"props":1771,"children":1772},{"style":779},[1773],{"type":49,"value":871},{"type":44,"tag":766,"props":1775,"children":1776},{"style":785},[1777],{"type":49,"value":163},{"type":44,"tag":766,"props":1779,"children":1780},{"style":824},[1781],{"type":49,"value":880},{"type":44,"tag":766,"props":1783,"children":1784},{"style":779},[1785],{"type":49,"value":885},{"type":44,"tag":766,"props":1787,"children":1788},{"style":785},[1789],{"type":49,"value":890},{"type":44,"tag":766,"props":1791,"children":1792},{"class":768,"line":975},[1793,1797,1801,1805,1809,1814],{"type":44,"tag":766,"props":1794,"children":1795},{"style":773},[1796],{"type":49,"value":776},{"type":44,"tag":766,"props":1798,"children":1799},{"style":779},[1800],{"type":49,"value":737},{"type":44,"tag":766,"props":1802,"children":1803},{"style":785},[1804],{"type":49,"value":788},{"type":44,"tag":766,"props":1806,"children":1807},{"style":791},[1808],{"type":49,"value":794},{"type":44,"tag":766,"props":1810,"children":1811},{"style":779},[1812],{"type":49,"value":1813}," result",{"type":44,"tag":766,"props":1815,"children":1816},{"style":785},[1817],{"type":49,"value":890},{"type":44,"tag":766,"props":1819,"children":1820},{"class":768,"line":984},[1821,1825,1830,1834,1838,1842],{"type":44,"tag":766,"props":1822,"children":1823},{"style":773},[1824],{"type":49,"value":776},{"type":44,"tag":766,"props":1826,"children":1827},{"style":779},[1828],{"type":49,"value":1829}," b ",{"type":44,"tag":766,"props":1831,"children":1832},{"style":785},[1833],{"type":49,"value":788},{"type":44,"tag":766,"props":1835,"children":1836},{"style":791},[1837],{"type":49,"value":794},{"type":44,"tag":766,"props":1839,"children":1840},{"style":779},[1841],{"type":49,"value":1813},{"type":44,"tag":766,"props":1843,"children":1844},{"style":785},[1845],{"type":49,"value":890},{"type":44,"tag":766,"props":1847,"children":1848},{"class":768,"line":993},[1849],{"type":44,"tag":766,"props":1850,"children":1851},{"emptyLinePlaceholder":1174},[1852],{"type":49,"value":1177},{"type":44,"tag":766,"props":1854,"children":1855},{"class":768,"line":1002},[1856],{"type":44,"tag":766,"props":1857,"children":1858},{"style":897},[1859],{"type":49,"value":1860},"\u002F\u002F Good — buffer once, reuse the array.\n",{"type":44,"tag":766,"props":1862,"children":1863},{"class":768,"line":1011},[1864,1868,1872,1876,1880,1884,1888,1892,1896,1900,1904,1908,1912,1916,1920,1924,1928,1932,1936,1940,1944,1948,1952,1956],{"type":44,"tag":766,"props":1865,"children":1866},{"style":773},[1867],{"type":49,"value":776},{"type":44,"tag":766,"props":1869,"children":1870},{"style":779},[1871],{"type":49,"value":782},{"type":44,"tag":766,"props":1873,"children":1874},{"style":785},[1875],{"type":49,"value":788},{"type":44,"tag":766,"props":1877,"children":1878},{"style":791},[1879],{"type":49,"value":794},{"type":44,"tag":766,"props":1881,"children":1882},{"style":779},[1883],{"type":49,"value":799},{"type":44,"tag":766,"props":1885,"children":1886},{"style":785},[1887],{"type":49,"value":163},{"type":44,"tag":766,"props":1889,"children":1890},{"style":779},[1891],{"type":49,"value":808},{"type":44,"tag":766,"props":1893,"children":1894},{"style":785},[1895],{"type":49,"value":163},{"type":44,"tag":766,"props":1897,"children":1898},{"style":779},[1899],{"type":49,"value":817},{"type":44,"tag":766,"props":1901,"children":1902},{"style":785},[1903],{"type":49,"value":163},{"type":44,"tag":766,"props":1905,"children":1906},{"style":824},[1907],{"type":49,"value":827},{"type":44,"tag":766,"props":1909,"children":1910},{"style":779},[1911],{"type":49,"value":832},{"type":44,"tag":766,"props":1913,"children":1914},{"style":785},[1915],{"type":49,"value":837},{"type":44,"tag":766,"props":1917,"children":1918},{"style":840},[1919],{"type":49,"value":843},{"type":44,"tag":766,"props":1921,"children":1922},{"style":785},[1923],{"type":49,"value":837},{"type":44,"tag":766,"props":1925,"children":1926},{"style":785},[1927],{"type":49,"value":852},{"type":44,"tag":766,"props":1929,"children":1930},{"style":785},[1931],{"type":49,"value":857},{"type":44,"tag":766,"props":1933,"children":1934},{"style":840},[1935],{"type":49,"value":862},{"type":44,"tag":766,"props":1937,"children":1938},{"style":785},[1939],{"type":49,"value":837},{"type":44,"tag":766,"props":1941,"children":1942},{"style":779},[1943],{"type":49,"value":871},{"type":44,"tag":766,"props":1945,"children":1946},{"style":785},[1947],{"type":49,"value":163},{"type":44,"tag":766,"props":1949,"children":1950},{"style":824},[1951],{"type":49,"value":880},{"type":44,"tag":766,"props":1953,"children":1954},{"style":779},[1955],{"type":49,"value":885},{"type":44,"tag":766,"props":1957,"children":1958},{"style":785},[1959],{"type":49,"value":890},{"type":44,"tag":766,"props":1961,"children":1962},{"class":768,"line":1020},[1963,1967,1971,1975,1980],{"type":44,"tag":766,"props":1964,"children":1965},{"style":773},[1966],{"type":49,"value":776},{"type":44,"tag":766,"props":1968,"children":1969},{"style":779},[1970],{"type":49,"value":737},{"type":44,"tag":766,"props":1972,"children":1973},{"style":785},[1974],{"type":49,"value":788},{"type":44,"tag":766,"props":1976,"children":1977},{"style":779},[1978],{"type":49,"value":1979}," users",{"type":44,"tag":766,"props":1981,"children":1982},{"style":785},[1983],{"type":49,"value":890},{"type":44,"tag":766,"props":1985,"children":1986},{"class":768,"line":1029},[1987,1991,1995,1999,2003],{"type":44,"tag":766,"props":1988,"children":1989},{"style":773},[1990],{"type":49,"value":776},{"type":44,"tag":766,"props":1992,"children":1993},{"style":779},[1994],{"type":49,"value":1829},{"type":44,"tag":766,"props":1996,"children":1997},{"style":785},[1998],{"type":49,"value":788},{"type":44,"tag":766,"props":2000,"children":2001},{"style":779},[2002],{"type":49,"value":1979},{"type":44,"tag":766,"props":2004,"children":2005},{"style":785},[2006],{"type":49,"value":890},{"type":44,"tag":56,"props":2008,"children":2009},{},[2010,2012,2018,2019,2025,2027,2032,2034,2039],{"type":49,"value":2011},"If you've seen ",{"type":44,"tag":111,"props":2013,"children":2015},{"className":2014},[],[2016],{"type":49,"value":2017},"collect(...)",{"type":49,"value":217},{"type":44,"tag":111,"props":2020,"children":2022},{"className":2021},[],[2023],{"type":49,"value":2024},"toArray(...)",{"type":49,"value":2026}," helpers in a codebase wrapping ",{"type":44,"tag":111,"props":2028,"children":2030},{"className":2029},[],[2031],{"type":49,"value":717},{"type":49,"value":2033},", they're vestigial — ",{"type":44,"tag":111,"props":2035,"children":2037},{"className":2036},[],[2038],{"type":49,"value":685},{"type":49,"value":2040}," does the same thing for free. Remove them when you touch the surrounding code.",{"type":44,"tag":79,"props":2042,"children":2044},{"id":2043},"running-queries-from-a-short-script",[2045],{"type":49,"value":2046},"Running queries from a short script",{"type":44,"tag":56,"props":2048,"children":2049},{},[2050,2052,2058,2060,2066,2068,2074,2076,2081,2083,2088,2090,2096],{"type":49,"value":2051},"When the user is running a one-off ",{"type":44,"tag":111,"props":2053,"children":2055},{"className":2054},[],[2056],{"type":49,"value":2057},"tsx my-script.ts",{"type":49,"value":2059}," (not a long-lived server), call ",{"type":44,"tag":111,"props":2061,"children":2063},{"className":2062},[],[2064],{"type":49,"value":2065},"await db.close()",{"type":49,"value":2067}," at the end so the process exits cleanly — on Postgres the façade-owned pool keeps Node's event loop alive; on Mongo the façade-owned ",{"type":44,"tag":111,"props":2069,"children":2071},{"className":2070},[],[2072],{"type":49,"value":2073},"MongoClient",{"type":49,"value":2075}," does the same. See ",{"type":44,"tag":111,"props":2077,"children":2079},{"className":2078},[],[2080],{"type":49,"value":203},{"type":49,"value":2082}," § ",{"type":44,"tag":71,"props":2084,"children":2085},{},[2086],{"type":49,"value":2087},"Running as a script (teardown)",{"type":49,"value":2089}," for the full pattern including ",{"type":44,"tag":111,"props":2091,"children":2093},{"className":2092},[],[2094],{"type":49,"value":2095},"await using",{"type":49,"value":163},{"type":44,"tag":755,"props":2098,"children":2100},{"className":757,"code":2099,"language":759,"meta":760,"style":760},"\u002F\u002F src\u002Fscripts\u002Fseed.ts\nimport { db } from '..\u002Fprisma\u002Fdb';\n\n\u002F\u002F Postgres — PascalCase model root from contract\nfor (const u of users) {\n  await db.orm.User.create(u);\n}\n\n\u002F\u002F Mongo — lowercased plural root from contract (e.g. users, not User)\n\u002F\u002F for (const u of users) {\n\u002F\u002F   await db.orm.users.create(u);\n\u002F\u002F }\n\nconsole.log('Seeded.');\nawait db.close();\n",[2101],{"type":44,"tag":111,"props":2102,"children":2103},{"__ignoreMap":760},[2104,2112,2156,2163,2171,2204,2258,2265,2272,2280,2288,2296,2304,2311,2353],{"type":44,"tag":766,"props":2105,"children":2106},{"class":768,"line":769},[2107],{"type":44,"tag":766,"props":2108,"children":2109},{"style":897},[2110],{"type":49,"value":2111},"\u002F\u002F src\u002Fscripts\u002Fseed.ts\n",{"type":44,"tag":766,"props":2113,"children":2114},{"class":768,"line":893},[2115,2120,2125,2129,2134,2139,2143,2148,2152],{"type":44,"tag":766,"props":2116,"children":2117},{"style":791},[2118],{"type":49,"value":2119},"import",{"type":44,"tag":766,"props":2121,"children":2122},{"style":785},[2123],{"type":49,"value":2124}," {",{"type":44,"tag":766,"props":2126,"children":2127},{"style":779},[2128],{"type":49,"value":799},{"type":44,"tag":766,"props":2130,"children":2131},{"style":785},[2132],{"type":49,"value":2133}," }",{"type":44,"tag":766,"props":2135,"children":2136},{"style":791},[2137],{"type":49,"value":2138}," from",{"type":44,"tag":766,"props":2140,"children":2141},{"style":785},[2142],{"type":49,"value":857},{"type":44,"tag":766,"props":2144,"children":2145},{"style":840},[2146],{"type":49,"value":2147},"..\u002Fprisma\u002Fdb",{"type":44,"tag":766,"props":2149,"children":2150},{"style":785},[2151],{"type":49,"value":837},{"type":44,"tag":766,"props":2153,"children":2154},{"style":785},[2155],{"type":49,"value":890},{"type":44,"tag":766,"props":2157,"children":2158},{"class":768,"line":975},[2159],{"type":44,"tag":766,"props":2160,"children":2161},{"emptyLinePlaceholder":1174},[2162],{"type":49,"value":1177},{"type":44,"tag":766,"props":2164,"children":2165},{"class":768,"line":984},[2166],{"type":44,"tag":766,"props":2167,"children":2168},{"style":897},[2169],{"type":49,"value":2170},"\u002F\u002F Postgres — PascalCase model root from contract\n",{"type":44,"tag":766,"props":2172,"children":2173},{"class":768,"line":993},[2174,2178,2182,2186,2191,2195,2200],{"type":44,"tag":766,"props":2175,"children":2176},{"style":791},[2177],{"type":49,"value":1213},{"type":44,"tag":766,"props":2179,"children":2180},{"style":779},[2181],{"type":49,"value":1222},{"type":44,"tag":766,"props":2183,"children":2184},{"style":773},[2185],{"type":49,"value":776},{"type":44,"tag":766,"props":2187,"children":2188},{"style":779},[2189],{"type":49,"value":2190}," u ",{"type":44,"tag":766,"props":2192,"children":2193},{"style":785},[2194],{"type":49,"value":1236},{"type":44,"tag":766,"props":2196,"children":2197},{"style":779},[2198],{"type":49,"value":2199}," users) ",{"type":44,"tag":766,"props":2201,"children":2202},{"style":785},[2203],{"type":49,"value":1318},{"type":44,"tag":766,"props":2205,"children":2206},{"class":768,"line":1002},[2207,2212,2216,2220,2224,2228,2232,2236,2241,2245,2250,2254],{"type":44,"tag":766,"props":2208,"children":2209},{"style":791},[2210],{"type":49,"value":2211},"  await",{"type":44,"tag":766,"props":2213,"children":2214},{"style":779},[2215],{"type":49,"value":799},{"type":44,"tag":766,"props":2217,"children":2218},{"style":785},[2219],{"type":49,"value":163},{"type":44,"tag":766,"props":2221,"children":2222},{"style":779},[2223],{"type":49,"value":808},{"type":44,"tag":766,"props":2225,"children":2226},{"style":785},[2227],{"type":49,"value":163},{"type":44,"tag":766,"props":2229,"children":2230},{"style":779},[2231],{"type":49,"value":817},{"type":44,"tag":766,"props":2233,"children":2234},{"style":785},[2235],{"type":49,"value":163},{"type":44,"tag":766,"props":2237,"children":2238},{"style":824},[2239],{"type":49,"value":2240},"create",{"type":44,"tag":766,"props":2242,"children":2243},{"style":1329},[2244],{"type":49,"value":832},{"type":44,"tag":766,"props":2246,"children":2247},{"style":779},[2248],{"type":49,"value":2249},"u",{"type":44,"tag":766,"props":2251,"children":2252},{"style":1329},[2253],{"type":49,"value":871},{"type":44,"tag":766,"props":2255,"children":2256},{"style":785},[2257],{"type":49,"value":890},{"type":44,"tag":766,"props":2259,"children":2260},{"class":768,"line":1011},[2261],{"type":44,"tag":766,"props":2262,"children":2263},{"style":785},[2264],{"type":49,"value":1353},{"type":44,"tag":766,"props":2266,"children":2267},{"class":768,"line":1020},[2268],{"type":44,"tag":766,"props":2269,"children":2270},{"emptyLinePlaceholder":1174},[2271],{"type":49,"value":1177},{"type":44,"tag":766,"props":2273,"children":2274},{"class":768,"line":1029},[2275],{"type":44,"tag":766,"props":2276,"children":2277},{"style":897},[2278],{"type":49,"value":2279},"\u002F\u002F Mongo — lowercased plural root from contract (e.g. users, not User)\n",{"type":44,"tag":766,"props":2281,"children":2282},{"class":768,"line":1170},[2283],{"type":44,"tag":766,"props":2284,"children":2285},{"style":897},[2286],{"type":49,"value":2287},"\u002F\u002F for (const u of users) {\n",{"type":44,"tag":766,"props":2289,"children":2290},{"class":768,"line":1180},[2291],{"type":44,"tag":766,"props":2292,"children":2293},{"style":897},[2294],{"type":49,"value":2295},"\u002F\u002F   await db.orm.users.create(u);\n",{"type":44,"tag":766,"props":2297,"children":2298},{"class":768,"line":1189},[2299],{"type":44,"tag":766,"props":2300,"children":2301},{"style":897},[2302],{"type":49,"value":2303},"\u002F\u002F }\n",{"type":44,"tag":766,"props":2305,"children":2306},{"class":768,"line":1198},[2307],{"type":44,"tag":766,"props":2308,"children":2309},{"emptyLinePlaceholder":1174},[2310],{"type":49,"value":1177},{"type":44,"tag":766,"props":2312,"children":2313},{"class":768,"line":1207},[2314,2319,2323,2328,2332,2336,2341,2345,2349],{"type":44,"tag":766,"props":2315,"children":2316},{"style":779},[2317],{"type":49,"value":2318},"console",{"type":44,"tag":766,"props":2320,"children":2321},{"style":785},[2322],{"type":49,"value":163},{"type":44,"tag":766,"props":2324,"children":2325},{"style":824},[2326],{"type":49,"value":2327},"log",{"type":44,"tag":766,"props":2329,"children":2330},{"style":779},[2331],{"type":49,"value":832},{"type":44,"tag":766,"props":2333,"children":2334},{"style":785},[2335],{"type":49,"value":837},{"type":44,"tag":766,"props":2337,"children":2338},{"style":840},[2339],{"type":49,"value":2340},"Seeded.",{"type":44,"tag":766,"props":2342,"children":2343},{"style":785},[2344],{"type":49,"value":837},{"type":44,"tag":766,"props":2346,"children":2347},{"style":779},[2348],{"type":49,"value":871},{"type":44,"tag":766,"props":2350,"children":2351},{"style":785},[2352],{"type":49,"value":890},{"type":44,"tag":766,"props":2354,"children":2355},{"class":768,"line":30},[2356,2360,2364,2368,2373,2377],{"type":44,"tag":766,"props":2357,"children":2358},{"style":791},[2359],{"type":49,"value":685},{"type":44,"tag":766,"props":2361,"children":2362},{"style":779},[2363],{"type":49,"value":799},{"type":44,"tag":766,"props":2365,"children":2366},{"style":785},[2367],{"type":49,"value":163},{"type":44,"tag":766,"props":2369,"children":2370},{"style":824},[2371],{"type":49,"value":2372},"close",{"type":44,"tag":766,"props":2374,"children":2375},{"style":779},[2376],{"type":49,"value":885},{"type":44,"tag":766,"props":2378,"children":2379},{"style":785},[2380],{"type":49,"value":890},{"type":44,"tag":79,"props":2382,"children":2384},{"id":2383},"common-pitfalls-cross-target",[2385],{"type":49,"value":2386},"Common Pitfalls (cross-target)",{"type":44,"tag":2388,"props":2389,"children":2390},"ol",{},[2391,2428,2506],{"type":44,"tag":90,"props":2392,"children":2393},{},[2394,2399,2401,2406,2408,2416,2418,2426],{"type":44,"tag":60,"props":2395,"children":2396},{},[2397],{"type":49,"value":2398},"Using Postgres examples on a Mongo project (or vice versa).",{"type":49,"value":2400}," Check ",{"type":44,"tag":111,"props":2402,"children":2404},{"className":2403},[],[2405],{"type":49,"value":195},{"type":49,"value":2407}," and load the correct target guide (",{"type":44,"tag":363,"props":2409,"children":2410},{"href":365},[2411],{"type":44,"tag":111,"props":2412,"children":2414},{"className":2413},[],[2415],{"type":49,"value":372},{"type":49,"value":2417}," or ",{"type":44,"tag":363,"props":2419,"children":2420},{"href":406},[2421],{"type":44,"tag":111,"props":2422,"children":2424},{"className":2423},[],[2425],{"type":49,"value":413},{"type":49,"value":2427},").",{"type":44,"tag":90,"props":2429,"children":2430},{},[2431,2456,2458,2463,2464,2469,2471,2476,2477,2482,2483,2489,2491,2497,2499,2504],{"type":44,"tag":60,"props":2432,"children":2433},{},[2434,2436,2441,2442,2447,2449,2454],{"type":49,"value":2435},"Writing a ",{"type":44,"tag":111,"props":2437,"children":2439},{"className":2438},[],[2440],{"type":49,"value":918},{"type":49,"value":217},{"type":44,"tag":111,"props":2443,"children":2445},{"className":2444},[],[2446],{"type":49,"value":925},{"type":49,"value":2448}," helper to convert ",{"type":44,"tag":111,"props":2450,"children":2452},{"className":2451},[],[2453],{"type":49,"value":717},{"type":49,"value":2455}," to an array.",{"type":49,"value":2457}," ",{"type":44,"tag":111,"props":2459,"children":2461},{"className":2460},[],[2462],{"type":49,"value":717},{"type":49,"value":719},{"type":44,"tag":111,"props":2465,"children":2467},{"className":2466},[],[2468],{"type":49,"value":728},{"type":49,"value":2470}," which ",{"type":44,"tag":71,"props":2472,"children":2473},{},[2474],{"type":49,"value":2475},"is",{"type":49,"value":737},{"type":44,"tag":111,"props":2478,"children":2480},{"className":2479},[],[2481],{"type":49,"value":743},{"type":49,"value":374},{"type":44,"tag":111,"props":2484,"children":2486},{"className":2485},[],[2487],{"type":49,"value":2488},"await collection.all()",{"type":49,"value":2490}," directly yields ",{"type":44,"tag":111,"props":2492,"children":2494},{"className":2493},[],[2495],{"type":49,"value":2496},"Row[]",{"type":49,"value":2498},". See ",{"type":44,"tag":71,"props":2500,"children":2501},{},[2502],{"type":49,"value":2503},"Consuming the result",{"type":49,"value":2505}," above.",{"type":44,"tag":90,"props":2507,"children":2508},{},[2509,2521,2523,2528],{"type":44,"tag":60,"props":2510,"children":2511},{},[2512,2514,2519],{"type":49,"value":2513},"Consuming an ",{"type":44,"tag":111,"props":2515,"children":2517},{"className":2516},[],[2518],{"type":49,"value":1644},{"type":49,"value":2520}," twice.",{"type":49,"value":2522}," Each result is single-use. The second consumer throws ",{"type":44,"tag":111,"props":2524,"children":2526},{"className":2525},[],[2527],{"type":49,"value":1676},{"type":49,"value":2529},". Buffer once into a variable and reuse the variable.",{"type":44,"tag":56,"props":2531,"children":2532},{},[2533],{"type":49,"value":2534},"Target-specific pitfalls live in the per-target guides.",{"type":44,"tag":79,"props":2536,"children":2538},{"id":2537},"what-prisma-next-doesnt-do-yet",[2539],{"type":49,"value":2540},"What Prisma Next doesn't do yet",{"type":44,"tag":86,"props":2542,"children":2543},{},[2544,2614,2639,2697,2771,2796,2835,2896,2943,2974,3012,3057,3112],{"type":44,"tag":90,"props":2545,"children":2546},{},[2547,2560,2562,2568,2570,2576,2578,2583,2585,2591,2592,2598,2600,2605,2607,2612],{"type":44,"tag":60,"props":2548,"children":2549},{},[2550,2552,2558],{"type":49,"value":2551},"N:M ",{"type":44,"tag":111,"props":2553,"children":2555},{"className":2554},[],[2556],{"type":49,"value":2557},".include()",{"type":49,"value":2559}," across a junction table.",{"type":49,"value":2561}," The contract IR supports many-to-many relations with a ",{"type":44,"tag":111,"props":2563,"children":2565},{"className":2564},[],[2566],{"type":49,"value":2567},"through",{"type":49,"value":2569}," junction table, and ",{"type":44,"tag":111,"props":2571,"children":2573},{"className":2572},[],[2574],{"type":49,"value":2575},"N:M",{"type":49,"value":2577}," relations appear as valid relation names on the ORM collection. However, ",{"type":44,"tag":111,"props":2579,"children":2581},{"className":2580},[],[2582],{"type":49,"value":2557},{"type":49,"value":2584}," on an N:M relation does not emit the two-step junction join — the query plan builder only handles the direct join columns (",{"type":44,"tag":111,"props":2586,"children":2588},{"className":2587},[],[2589],{"type":49,"value":2590},"localColumn",{"type":49,"value":217},{"type":44,"tag":111,"props":2593,"children":2595},{"className":2594},[],[2596],{"type":49,"value":2597},"targetColumn",{"type":49,"value":2599},") and ignores the ",{"type":44,"tag":111,"props":2601,"children":2603},{"className":2602},[],[2604],{"type":49,"value":2567},{"type":49,"value":2606}," metadata. Attempting it either produces wrong results or an error. Workaround: express the N:M traversal through ",{"type":44,"tag":111,"props":2608,"children":2610},{"className":2609},[],[2611],{"type":49,"value":388},{"type":49,"value":2613}," with an explicit join on the junction table.",{"type":44,"tag":90,"props":2615,"children":2616},{},[2617,2622,2623,2629,2631,2637],{"type":44,"tag":60,"props":2618,"children":2619},{},[2620],{"type":49,"value":2621},"N:M nested mutations.",{"type":49,"value":2457},{"type":44,"tag":111,"props":2624,"children":2626},{"className":2625},[],[2627],{"type":49,"value":2628},"mutation-executor.ts",{"type":49,"value":2630}," explicitly throws ",{"type":44,"tag":111,"props":2632,"children":2634},{"className":2633},[],[2635],{"type":49,"value":2636},"'N:M nested mutations are not supported yet'",{"type":49,"value":2638}," for nested creates\u002Flinks through an N:M relation.",{"type":44,"tag":90,"props":2640,"children":2641},{},[2642,2666,2668,2674,2676,2681,2683,2688,2690,2696],{"type":44,"tag":60,"props":2643,"children":2644},{},[2645,2651,2652,2658,2659,2664],{"type":44,"tag":111,"props":2646,"children":2648},{"className":2647},[],[2649],{"type":49,"value":2650},"and",{"type":49,"value":217},{"type":44,"tag":111,"props":2653,"children":2655},{"className":2654},[],[2656],{"type":49,"value":2657},"or",{"type":49,"value":217},{"type":44,"tag":111,"props":2660,"children":2662},{"className":2661},[],[2663],{"type":49,"value":910},{"type":49,"value":2665}," combinators in the postgres façade.",{"type":49,"value":2667}," The combinators currently import from ",{"type":44,"tag":111,"props":2669,"children":2671},{"className":2670},[],[2672],{"type":49,"value":2673},"@prisma-next\u002Fsql-orm-client",{"type":49,"value":2675}," (an internal package). Workaround today: import them from ",{"type":44,"tag":111,"props":2677,"children":2679},{"className":2678},[],[2680],{"type":49,"value":2673},{"type":49,"value":2682}," directly, the way the example apps do. If you want them on ",{"type":44,"tag":111,"props":2684,"children":2686},{"className":2685},[],[2687],{"type":49,"value":358},{"type":49,"value":2689},", file a feature request via ",{"type":44,"tag":111,"props":2691,"children":2693},{"className":2692},[],[2694],{"type":49,"value":2695},"prisma-next-feedback",{"type":49,"value":163},{"type":44,"tag":90,"props":2698,"children":2699},{},[2700,2718,2719,2725,2727,2733,2735,2740,2742,2748,2749,2755,2756,2762,2764,2769],{"type":44,"tag":60,"props":2701,"children":2702},{},[2703,2709,2710,2716],{"type":44,"tag":111,"props":2704,"children":2706},{"className":2705},[],[2707],{"type":49,"value":2708},".orderBy(...)",{"type":49,"value":217},{"type":44,"tag":111,"props":2711,"children":2713},{"className":2712},[],[2714],{"type":49,"value":2715},".take(...)",{"type":49,"value":2717}," on grouped aggregates (Postgres).",{"type":49,"value":2457},{"type":44,"tag":111,"props":2720,"children":2722},{"className":2721},[],[2723],{"type":49,"value":2724},"db.orm.\u003CModel>.groupBy(...).aggregate(...)",{"type":49,"value":2726}," materializes a ",{"type":44,"tag":111,"props":2728,"children":2730},{"className":2729},[],[2731],{"type":49,"value":2732},"Promise\u003CArray\u003CGroup & Aggregates>>",{"type":49,"value":2734}," and exposes neither ordering nor row limits at the DB layer. Result: a \"top-N groups by SUM\" query falls back to JS-side sort + slice over the full grouped result, which is fine at small cardinalities and bad at scale. Workarounds: (a) drop to ",{"type":44,"tag":111,"props":2736,"children":2738},{"className":2737},[],[2739],{"type":49,"value":388},{"type":49,"value":2741}," and write the ",{"type":44,"tag":111,"props":2743,"children":2745},{"className":2744},[],[2746],{"type":49,"value":2747},"GROUP BY",{"type":49,"value":382},{"type":44,"tag":111,"props":2750,"children":2752},{"className":2751},[],[2753],{"type":49,"value":2754},"ORDER BY",{"type":49,"value":382},{"type":44,"tag":111,"props":2757,"children":2759},{"className":2758},[],[2760],{"type":49,"value":2761},"LIMIT",{"type":49,"value":2763}," against the aggregated table directly; (b) live with the JS-side sort\u002Fslice if the grouped cardinality is bounded. File a feature request via ",{"type":44,"tag":111,"props":2765,"children":2767},{"className":2766},[],[2768],{"type":49,"value":2695},{"type":49,"value":2770}," if this is hitting you in production.",{"type":44,"tag":90,"props":2772,"children":2773},{},[2774,2779,2781,2787,2789,2794],{"type":44,"tag":60,"props":2775,"children":2776},{},[2777],{"type":49,"value":2778},"A raw-SQL lane.",{"type":49,"value":2780}," Prisma Next does not currently expose a user-facing raw-SQL surface (no ",{"type":44,"tag":111,"props":2782,"children":2784},{"className":2783},[],[2785],{"type":49,"value":2786},"db.sql.raw(...)",{"type":49,"value":2788},"). Workaround: model the query through the SQL builder or — for shapes the builder can't yet express — file a feature request via ",{"type":44,"tag":111,"props":2790,"children":2792},{"className":2791},[],[2793],{"type":49,"value":2695},{"type":49,"value":2795}," describing the shape so the team can decide whether to grow the builder or ship a raw lane.",{"type":44,"tag":90,"props":2797,"children":2798},{},[2799,2812,2814,2820,2822,2827,2829,2834],{"type":44,"tag":60,"props":2800,"children":2801},{},[2802,2804,2810],{"type":49,"value":2803},"TypedSQL (",{"type":44,"tag":111,"props":2805,"children":2807},{"className":2806},[],[2808],{"type":49,"value":2809},".sql",{"type":49,"value":2811}," files compiled into typed callables).",{"type":49,"value":2813}," Not implemented. Workaround: stick to the SQL builder; for repeated queries, extract a function that returns the built plan and call ",{"type":44,"tag":111,"props":2815,"children":2817},{"className":2816},[],[2818],{"type":49,"value":2819},"db.runtime().execute(plan)",{"type":49,"value":2821}," at the call site. If you want a ",{"type":44,"tag":111,"props":2823,"children":2825},{"className":2824},[],[2826],{"type":49,"value":2809},{"type":49,"value":2828},"-file compile path, file a feature request via ",{"type":44,"tag":111,"props":2830,"children":2832},{"className":2831},[],[2833],{"type":49,"value":2695},{"type":49,"value":163},{"type":44,"tag":90,"props":2836,"children":2837},{},[2838,2849,2851,2857,2859,2865,2867,2873,2875,2880,2882,2888,2890,2895],{"type":44,"tag":60,"props":2839,"children":2840},{},[2841,2847],{"type":44,"tag":111,"props":2842,"children":2844},{"className":2843},[],[2845],{"type":49,"value":2846},"EXPLAIN",{"type":49,"value":2848}," \u002F query-plan inspection.",{"type":49,"value":2850}," Prisma Next does not expose an ",{"type":44,"tag":111,"props":2852,"children":2854},{"className":2853},[],[2855],{"type":49,"value":2856},".explain()",{"type":49,"value":2858}," method. Workaround: connect a ",{"type":44,"tag":111,"props":2860,"children":2862},{"className":2861},[],[2863],{"type":49,"value":2864},"pg.Pool",{"type":49,"value":2866}," you control via the runtime's ",{"type":44,"tag":111,"props":2868,"children":2870},{"className":2869},[],[2871],{"type":49,"value":2872},"pg:",{"type":49,"value":2874}," binding (see ",{"type":44,"tag":111,"props":2876,"children":2878},{"className":2877},[],[2879],{"type":49,"value":203},{"type":49,"value":2881},") and issue ",{"type":44,"tag":111,"props":2883,"children":2885},{"className":2884},[],[2886],{"type":49,"value":2887},"EXPLAIN ANALYZE",{"type":49,"value":2889}," through it. If you want a first-class plan-inspection surface, file a feature request via ",{"type":44,"tag":111,"props":2891,"children":2893},{"className":2892},[],[2894],{"type":49,"value":2695},{"type":49,"value":163},{"type":44,"tag":90,"props":2897,"children":2898},{},[2899,2904,2906,2912,2914,2920,2922,2928,2930,2935,2937,2942],{"type":44,"tag":60,"props":2900,"children":2901},{},[2902],{"type":49,"value":2903},"Streaming large result sets.",{"type":49,"value":2905}," No ",{"type":44,"tag":111,"props":2907,"children":2909},{"className":2908},[],[2910],{"type":49,"value":2911},".stream()",{"type":49,"value":2913}," cursor today. Workaround: paginate via ",{"type":44,"tag":111,"props":2915,"children":2917},{"className":2916},[],[2918],{"type":49,"value":2919},".skip(n).take(m)",{"type":49,"value":2921}," for moderate sizes; for very large sets, hold a ",{"type":44,"tag":111,"props":2923,"children":2925},{"className":2924},[],[2926],{"type":49,"value":2927},"pg.Client",{"type":49,"value":2929}," from the runtime's ",{"type":44,"tag":111,"props":2931,"children":2933},{"className":2932},[],[2934],{"type":49,"value":2872},{"type":49,"value":2936}," binding and stream through it directly. If you want a built-in streaming surface, file a feature request via ",{"type":44,"tag":111,"props":2938,"children":2940},{"className":2939},[],[2941],{"type":49,"value":2695},{"type":49,"value":163},{"type":44,"tag":90,"props":2944,"children":2945},{},[2946,2958,2960,2966,2968,2973],{"type":44,"tag":60,"props":2947,"children":2948},{},[2949,2951,2957],{"type":49,"value":2950},"Multi-statement batching (Prisma-7-style ",{"type":44,"tag":111,"props":2952,"children":2954},{"className":2953},[],[2955],{"type":49,"value":2956},"db.$transaction([call1, call2])",{"type":49,"value":2427},{"type":49,"value":2959}," Prisma Next runs each call sequentially. Workaround: wrap atomically-related work in ",{"type":44,"tag":111,"props":2961,"children":2963},{"className":2962},[],[2964],{"type":49,"value":2965},"db.transaction(async (tx) => { ... })",{"type":49,"value":2967}," on Postgres. If you want batch-as-array semantics, file a feature request via ",{"type":44,"tag":111,"props":2969,"children":2971},{"className":2970},[],[2972],{"type":49,"value":2695},{"type":49,"value":163},{"type":44,"tag":90,"props":2975,"children":2976},{},[2977,2982,2983,2988,2990,2995,2997,3003,3005,3010],{"type":44,"tag":60,"props":2978,"children":2979},{},[2980],{"type":49,"value":2981},"Mongo façade transactions.",{"type":49,"value":2457},{"type":44,"tag":111,"props":2984,"children":2986},{"className":2985},[],[2987],{"type":49,"value":400},{"type":49,"value":2989}," does not expose ",{"type":44,"tag":111,"props":2991,"children":2993},{"className":2992},[],[2994],{"type":49,"value":116},{"type":49,"value":2996},". Multi-document atomicity is not yet wrapped in the Prisma Next Mongo façade. Workaround: use the MongoDB driver's session API directly if you control the client binding (",{"type":44,"tag":111,"props":2998,"children":3000},{"className":2999},[],[3001],{"type":49,"value":3002},"mongoClient:",{"type":49,"value":3004}," option). File a feature request via ",{"type":44,"tag":111,"props":3006,"children":3008},{"className":3007},[],[3009],{"type":49,"value":2695},{"type":49,"value":3011}," if you need a first-class façade surface.",{"type":44,"tag":90,"props":3013,"children":3014},{},[3015,3020,3021,3027,3028,3034,3036,3041,3043,3049,3050,3056],{"type":44,"tag":60,"props":3016,"children":3017},{},[3018],{"type":49,"value":3019},"Mongo ORM aggregates.",{"type":49,"value":2905},{"type":44,"tag":111,"props":3022,"children":3024},{"className":3023},[],[3025],{"type":49,"value":3026},".aggregate(...)",{"type":49,"value":217},{"type":44,"tag":111,"props":3029,"children":3031},{"className":3030},[],[3032],{"type":49,"value":3033},".groupBy(...)",{"type":49,"value":3035}," on ",{"type":44,"tag":111,"props":3037,"children":3039},{"className":3038},[],[3040],{"type":49,"value":420},{"type":49,"value":3042},". Workaround: express aggregations through ",{"type":44,"tag":111,"props":3044,"children":3046},{"className":3045},[],[3047],{"type":49,"value":3048},"db.query.from(...).group(...).build()",{"type":49,"value":565},{"type":44,"tag":111,"props":3051,"children":3053},{"className":3052},[],[3054],{"type":49,"value":3055},"runtime.execute(plan)",{"type":49,"value":163},{"type":44,"tag":90,"props":3058,"children":3059},{},[3060,3065,3067,3073,3075,3081,3082,3088,3090,3095,3097,3103,3105,3111],{"type":44,"tag":60,"props":3061,"children":3062},{},[3063],{"type":49,"value":3064},"Mongo filter helpers on the façade.",{"type":49,"value":3066}," Rich filters (",{"type":44,"tag":111,"props":3068,"children":3070},{"className":3069},[],[3071],{"type":49,"value":3072},".in",{"type":49,"value":3074},", ranges, boolean composition) currently import from ",{"type":44,"tag":111,"props":3076,"children":3078},{"className":3077},[],[3079],{"type":49,"value":3080},"@prisma-next\u002Fmongo-query-ast\u002Fexecution",{"type":49,"value":1222},{"type":44,"tag":111,"props":3083,"children":3085},{"className":3084},[],[3086],{"type":49,"value":3087},"MongoFieldFilter",{"type":49,"value":3089},", etc.) — not yet re-exported on ",{"type":44,"tag":111,"props":3091,"children":3093},{"className":3092},[],[3094],{"type":49,"value":400},{"type":49,"value":3096},". Workaround: use object equality ",{"type":44,"tag":111,"props":3098,"children":3100},{"className":3099},[],[3101],{"type":49,"value":3102},".where({ field: value })",{"type":49,"value":3104}," where possible; import from the internal package only when necessary. Tracked alongside façade-completeness gaps in Linear ",{"type":44,"tag":111,"props":3106,"children":3108},{"className":3107},[],[3109],{"type":49,"value":3110},"TML-2526",{"type":49,"value":163},{"type":44,"tag":90,"props":3113,"children":3114},{},[3115,3120,3122,3128,3130,3135,3137,3143,3145,3150,3152,3158,3160,3166,3167,3173,3175,3180,3181,3187],{"type":44,"tag":60,"props":3116,"children":3117},{},[3118],{"type":49,"value":3119},"Automatic N+1 detection.",{"type":49,"value":3121}," Prisma Next does not warn when an ",{"type":44,"tag":111,"props":3123,"children":3125},{"className":3124},[],[3126],{"type":49,"value":3127},".include(...)",{"type":49,"value":3129}," is missing. Workaround: be deliberate about ",{"type":44,"tag":111,"props":3131,"children":3133},{"className":3132},[],[3134],{"type":49,"value":3127},{"type":49,"value":3136}," in code review; the ",{"type":44,"tag":111,"props":3138,"children":3140},{"className":3139},[],[3141],{"type":49,"value":3142},"lints",{"type":49,"value":3144}," middleware (see ",{"type":44,"tag":111,"props":3146,"children":3148},{"className":3147},[],[3149],{"type":49,"value":203},{"type":49,"value":3151},") catches the more common authoring slips (missing ",{"type":44,"tag":111,"props":3153,"children":3155},{"className":3154},[],[3156],{"type":49,"value":3157},"WHERE",{"type":49,"value":3159}," on a ",{"type":44,"tag":111,"props":3161,"children":3163},{"className":3162},[],[3164],{"type":49,"value":3165},"DELETE",{"type":49,"value":217},{"type":44,"tag":111,"props":3168,"children":3170},{"className":3169},[],[3171],{"type":49,"value":3172},"UPDATE",{"type":49,"value":3174},", missing ",{"type":44,"tag":111,"props":3176,"children":3178},{"className":3177},[],[3179],{"type":49,"value":2761},{"type":49,"value":3159},{"type":44,"tag":111,"props":3182,"children":3184},{"className":3183},[],[3185],{"type":49,"value":3186},"SELECT",{"type":49,"value":2427},{"type":44,"tag":79,"props":3189,"children":3191},{"id":3190},"reference-files",[3192],{"type":49,"value":3193},"Reference Files",{"type":44,"tag":56,"props":3195,"children":3196},{},[3197],{"type":49,"value":3198},"This skill is split for selective loading. Target-specific reference paths live in the per-target guides:",{"type":44,"tag":86,"props":3200,"children":3201},{},[3202,3222],{"type":44,"tag":90,"props":3203,"children":3204},{},[3205,3210,3211],{"type":44,"tag":60,"props":3206,"children":3207},{},[3208],{"type":49,"value":3209},"Postgres",{"type":49,"value":374},{"type":44,"tag":363,"props":3212,"children":3214},{"href":3213},".\u002Fpostgres.md#reference-files",[3215,3220],{"type":44,"tag":111,"props":3216,"children":3218},{"className":3217},[],[3219],{"type":49,"value":372},{"type":49,"value":3221}," § Reference Files",{"type":44,"tag":90,"props":3223,"children":3224},{},[3225,3230,3231],{"type":44,"tag":60,"props":3226,"children":3227},{},[3228],{"type":49,"value":3229},"Mongo",{"type":49,"value":374},{"type":44,"tag":363,"props":3232,"children":3234},{"href":3233},".\u002Fmongo.md#reference-files",[3235,3240],{"type":44,"tag":111,"props":3236,"children":3238},{"className":3237},[],[3239],{"type":49,"value":413},{"type":49,"value":3221},{"type":44,"tag":79,"props":3242,"children":3244},{"id":3243},"checklist",[3245],{"type":49,"value":3246},"Checklist",{"type":44,"tag":86,"props":3248,"children":3251},{"className":3249},[3250],"contains-task-list",[3252,3289,3313,3322,3359,3402,3425],{"type":44,"tag":90,"props":3253,"children":3256},{"className":3254},[3255],"task-list-item",[3257,3262,3264,3269,3271,3279,3280,3288],{"type":44,"tag":3258,"props":3259,"children":3261},"input",{"disabled":1174,"type":3260},"checkbox",[],{"type":49,"value":3263}," Confirmed the active target from ",{"type":44,"tag":111,"props":3265,"children":3267},{"className":3266},[],[3268],{"type":49,"value":195},{"type":49,"value":3270}," and loaded the matching guide (",{"type":44,"tag":363,"props":3272,"children":3273},{"href":365},[3274],{"type":44,"tag":111,"props":3275,"children":3277},{"className":3276},[],[3278],{"type":49,"value":372},{"type":49,"value":2417},{"type":44,"tag":363,"props":3281,"children":3282},{"href":406},[3283],{"type":44,"tag":111,"props":3284,"children":3286},{"className":3285},[],[3287],{"type":49,"value":413},{"type":49,"value":2427},{"type":44,"tag":90,"props":3290,"children":3292},{"className":3291},[3255],[3293,3296,3298,3304,3305,3311],{"type":44,"tag":3258,"props":3294,"children":3295},{"disabled":1174,"type":3260},[],{"type":49,"value":3297}," For multi-namespace contracts, used ",{"type":44,"tag":111,"props":3299,"children":3301},{"className":3300},[],[3302],{"type":49,"value":3303},"db.orm.\u003Cns>.\u003CModel>",{"type":49,"value":217},{"type":44,"tag":111,"props":3306,"children":3308},{"className":3307},[],[3309],{"type":49,"value":3310},"db.sql.\u003Cns>.\u003Ctable>",{"type":49,"value":3312}," coordinates when the same bare name exists in more than one namespace.",{"type":44,"tag":90,"props":3314,"children":3316},{"className":3315},[3255],[3317,3320],{"type":44,"tag":3258,"props":3318,"children":3319},{"disabled":1174,"type":3260},[],{"type":49,"value":3321}," Chose the right lane (ORM by default; lower-level builder for shapes the ORM doesn't express).",{"type":44,"tag":90,"props":3323,"children":3325},{"className":3324},[3255],[3326,3329,3331,3336,3337,3343,3345,3351,3353,3358],{"type":44,"tag":3258,"props":3327,"children":3328},{"disabled":1174,"type":3260},[],{"type":49,"value":3330}," Used ",{"type":44,"tag":111,"props":3332,"children":3334},{"className":3333},[],[3335],{"type":49,"value":1364},{"type":49,"value":217},{"type":44,"tag":111,"props":3338,"children":3340},{"className":3339},[],[3341],{"type":49,"value":3342},".first({ pk })",{"type":49,"value":3344}," (Postgres) or ",{"type":44,"tag":111,"props":3346,"children":3348},{"className":3347},[],[3349],{"type":49,"value":3350},".where({ ... }).first()",{"type":49,"value":3352}," (Mongo) for single-row reads — not ",{"type":44,"tag":111,"props":3354,"children":3356},{"className":3355},[],[3357],{"type":49,"value":717},{"type":49,"value":163},{"type":44,"tag":90,"props":3360,"children":3362},{"className":3361},[3255],[3363,3366,3368,3373,3375,3380,3382,3387,3388,3393,3395,3400],{"type":44,"tag":3258,"props":3364,"children":3365},{"disabled":1174,"type":3260},[],{"type":49,"value":3367}," Consumed ",{"type":44,"tag":111,"props":3369,"children":3371},{"className":3370},[],[3372],{"type":49,"value":717},{"type":49,"value":3374}," with plain ",{"type":44,"tag":111,"props":3376,"children":3378},{"className":3377},[],[3379],{"type":49,"value":685},{"type":49,"value":3381}," (not a ",{"type":44,"tag":111,"props":3383,"children":3385},{"className":3384},[],[3386],{"type":49,"value":918},{"type":49,"value":217},{"type":44,"tag":111,"props":3389,"children":3391},{"className":3390},[],[3392],{"type":49,"value":925},{"type":49,"value":3394}," helper). Used ",{"type":44,"tag":111,"props":3396,"children":3398},{"className":3397},[],[3399],{"type":49,"value":700},{"type":49,"value":3401}," only when streaming is actually wanted, and never iterated the same result twice.",{"type":44,"tag":90,"props":3403,"children":3405},{"className":3404},[3255],[3406,3409,3411,3416,3418,3423],{"type":44,"tag":3258,"props":3407,"children":3408},{"disabled":1174,"type":3260},[],{"type":49,"value":3410}," Did NOT use ",{"type":44,"tag":111,"props":3412,"children":3414},{"className":3413},[],[3415],{"type":49,"value":536},{"type":49,"value":3417}," on a Mongo project or ",{"type":44,"tag":111,"props":3419,"children":3421},{"className":3420},[],[3422],{"type":49,"value":544},{"type":49,"value":3424}," where the Postgres SQL builder is meant.",{"type":44,"tag":90,"props":3426,"children":3428},{"className":3427},[3255],[3429,3432],{"type":44,"tag":3258,"props":3430,"children":3431},{"disabled":1174,"type":3260},[],{"type":49,"value":3433}," Completed the target-specific checklist in the loaded guide.",{"type":44,"tag":3435,"props":3436,"children":3437},"style",{},[3438],{"type":49,"value":3439},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":3441,"total":1180},[3442,3454,3469,3481,3493,3506,3524],{"slug":3443,"name":3443,"fn":3444,"description":3445,"org":3446,"tags":3447,"stars":26,"repoUrl":27,"updatedAt":3453},"prisma-next","guide Prisma Next project setup and usage","Route a vague Prisma Next prompt to the right specific skill. Use for \"help me with Prisma Next\", \"what is Prisma Next\", \"explain Prisma Next\", \"I'm new to PN\", \"where do I start\", \"what can I do with Prisma Next\", \"what can I do next with Prisma\", \"just ran createprisma\", \"tour of Prisma Next\", \"Prisma Next overview\", and comparison questions like \"Prisma Next vs Prisma 7\", \"PN vs Drizzle\", \"PN vs Kysely\", \"PN vs TypeORM\". Do NOT use when the prompt clearly matches a workflow skill — adoption \u002F quickstart \u002F first-touch orientation \u002F brownfield introspection, schema \u002F contract editing, migration authoring (db update \u002F migration plan \u002F migrate), migration review on deploy \u002F concurrent migrations, queries \u002F db.orm \u002F db.sql \u002F TypedSQL, Supabase \u002F RLS \u002F role binding, runtime \u002F db.ts \u002F middleware wiring, build \u002F Vite plugin \u002F Next.js plugin, debug \u002F structured error envelopes \u002F PN-* error codes, or feedback \u002F bug report \u002F feature request — load that sibling skill directly.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3448,3449,3450,3451],{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":3452,"slug":759,"type":15},"TypeScript","2026-07-17T05:32:04.322957",{"slug":3455,"name":3455,"fn":3456,"description":3457,"org":3458,"tags":3459,"stars":26,"repoUrl":27,"updatedAt":3468},"prisma-next-build","integrate Prisma Next into build systems","Wire Prisma Next into the project's build system with the right build-tool plugin — Vite today via @prisma-next\u002Fvite-plugin-contract-emit (Vite 7 \u002F 8); Next.js \u002F Webpack \u002F esbuild \u002F Rollup \u002F Turbopack are named as gaps rather than fabricated. Always offers the Vite plugin proactively when the project is using Vite. Use for vite plugin, vite-plugin, vite.config.ts, prismaVitePlugin, contract emit on save, HMR, hot reload contract, dev server, Next.js plugin, next plugin, withPrismaNext, webpack plugin, esbuild plugin, rollup plugin, build integration, dev server plugin, vite 7, vite 8.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3460,3463,3464,3465],{"name":3461,"slug":3462,"type":15},"Deployment","deployment",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":3466,"slug":3467,"type":15},"Vite","vite","2026-07-02T07:31:36.108254",{"slug":183,"name":183,"fn":3470,"description":3471,"org":3472,"tags":3473,"stars":26,"repoUrl":27,"updatedAt":3480},"edit Prisma Next data contracts and models","Edit the Prisma Next data contract — add models, fields, relations, indexes, enums, value objects (composite types), type aliases, namespaces (Postgres schemas), cross-contract foreign keys (cross-space FK), polymorphic types (`@@discriminator` \u002F `@@base`), use extension namespaces (`pgvector.Vector(...)`, `cipherstash.EncryptedString(...)`), wire `prisma-next.config.ts` with `defineConfig` from the `@prisma-next\u002F\u003Ctarget>\u002Fconfig` façade, and run `prisma-next contract emit`. Use for schema, models, fields, attributes, soft delete, paranoid, scopes, validations, callbacks, prisma schema, PSL, contract.prisma, contract.ts, contract.json, contract.d.ts, `@prisma-next\u002Fpostgres\u002Fconfig`, `@prisma-next\u002Fpostgres\u002Fcontract-builder`, `@prisma-next\u002Fpostgres\u002Fcontrol`, `@prisma-next\u002Fmongo\u002Fconfig`, `@prisma-next\u002Fmongo\u002Fcontract-builder`, `extensions:`, pgvector, cipherstash, postgis, paradedb, supabase, `@prisma-next\u002Fextension-supabase`, `@@control`, control policy, managed, tolerated, external, observed.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3474,3477,3478,3479],{"name":3475,"slug":3476,"type":15},"Data Modeling","data-modeling",{"name":17,"slug":18,"type":15},{"name":9,"slug":8,"type":15},{"name":3452,"slug":759,"type":15},"2026-07-30T05:30:10.426962",{"slug":266,"name":266,"fn":3482,"description":3483,"org":3484,"tags":3485,"stars":26,"repoUrl":27,"updatedAt":3492},"debug and recover from Prisma Next errors","Read a Prisma Next structured error envelope and route to the right recovery — code, domain, severity, why, fix, meta. Use for error, exception, my emit failed, my query won't typecheck, my query crashed, my migration won't apply, MIGRATION.HASH_MISMATCH, BUDGET.ROWS_EXCEEDED, BUDGET.TIME_EXCEEDED, RUNTIME.ABORTED, PLAN.HASH_MISMATCH, CONTRACT.MARKER_MISSING, PN-RUN-3001, PN-RUN-3002, PN-RUN-3030, PN-MIG-2001, PN-CLI-4011, PN-SCHEMA-0001, drift, capability missing, planner conflict, prisma studio, EXPLAIN, query log, db.end, db.close, script won't exit, hangs, close connection, pool.end, client is closed.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3486,3487,3490,3491],{"name":17,"slug":18,"type":15},{"name":3488,"slug":3489,"type":15},"Debugging","debugging",{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},"2026-07-24T05:37:10.436314",{"slug":2695,"name":2695,"fn":3494,"description":3495,"org":3496,"tags":3497,"stars":26,"repoUrl":27,"updatedAt":3505},"report Prisma Next issues and feedback","Hand a Prisma Next question or report off to the team — file a GitHub issue (bug or feature request), or route Q&A \u002F design discussion \u002F direct-team-contact to the Prisma Discord at pris.ly\u002Fdiscord. Use for bug, bug report, file an issue, report a bug, feature request, missing feature, this should be a feature, file this, this is a bug, this is broken, surprising behaviour, this doesn't work, file feedback, send feedback, capability gap, file via prisma-next-feedback, ask the team, talk to the team, talk to the Prisma team, talk to Prisma, Discord, Prisma Discord, Q&A, design feedback, is this the intended way, how should I do X, extension author question, extension author needs help.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3498,3501,3504],{"name":3499,"slug":3500,"type":15},"Documentation","documentation",{"name":3502,"slug":3503,"type":15},"GitHub","github",{"name":9,"slug":8,"type":15},"2026-07-02T07:31:34.870809",{"slug":3507,"name":3507,"fn":3508,"description":3509,"org":3510,"tags":3511,"stars":26,"repoUrl":27,"updatedAt":3523},"prisma-next-migration-review","review and resolve Prisma Next migrations","Review what Prisma Next migrations will run on merge or deploy, render the migration graph, resolve concurrent \u002F diamond-convergence conflicts, and configure environment refs for CI. Use for \"what migrations are going to run\", \"what runs on deploy\", merge conflict, diamond convergence, concurrent migrations, migration status, ref management, staging, production, MIGRATION.DIVERGED, MIGRATION.NO_MARKER, MIGRATION.MARKER_NOT_IN_HISTORY, prisma migrate status, prisma migrate diff, prisma migrate resolve.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3512,3515,3518,3519,3522],{"name":3513,"slug":3514,"type":15},"CI\u002FCD","ci-cd",{"name":3516,"slug":3517,"type":15},"Code Review","code-review",{"name":17,"slug":18,"type":15},{"name":3520,"slug":3521,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},"2026-07-24T05:37:11.422323",{"slug":3525,"name":3525,"fn":3526,"description":3527,"org":3528,"tags":3529,"stars":26,"repoUrl":27,"updatedAt":3534},"prisma-next-migrations","author and manage Prisma Next migrations","Author Prisma Next migrations — choose db update vs migration plan, edit the framework-rendered migration.ts (replace placeholder sentinels with dataTransform closures), recover from MIGRATION.HASH_MISMATCH or PN-MIG-2001 unfilled placeholder. Use for prisma migrate dev, prisma migrate deploy, prisma db push, db update, db update --dry-run, migration plan, migrate, migration new, migration show, db verify, db sign, data migration, this.dataTransform, dataTransform, placeholder, generated migration.ts, edit migration.ts, MIGRATION.HASH_MISMATCH, schema drift.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3530,3531,3532,3533],{"name":17,"slug":18,"type":15},{"name":3520,"slug":3521,"type":15},{"name":9,"slug":8,"type":15},{"name":3452,"slug":759,"type":15},"2026-07-24T05:37:13.469138",{"items":3536,"total":3645},[3537,3544,3551,3558,3565,3571,3579,3586,3594,3605,3615,3629],{"slug":3443,"name":3443,"fn":3444,"description":3445,"org":3538,"tags":3539,"stars":26,"repoUrl":27,"updatedAt":3453},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3540,3541,3542,3543],{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":3452,"slug":759,"type":15},{"slug":3455,"name":3455,"fn":3456,"description":3457,"org":3545,"tags":3546,"stars":26,"repoUrl":27,"updatedAt":3468},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3547,3548,3549,3550],{"name":3461,"slug":3462,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":3466,"slug":3467,"type":15},{"slug":183,"name":183,"fn":3470,"description":3471,"org":3552,"tags":3553,"stars":26,"repoUrl":27,"updatedAt":3480},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3554,3555,3556,3557],{"name":3475,"slug":3476,"type":15},{"name":17,"slug":18,"type":15},{"name":9,"slug":8,"type":15},{"name":3452,"slug":759,"type":15},{"slug":266,"name":266,"fn":3482,"description":3483,"org":3559,"tags":3560,"stars":26,"repoUrl":27,"updatedAt":3492},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3561,3562,3563,3564],{"name":17,"slug":18,"type":15},{"name":3488,"slug":3489,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"slug":2695,"name":2695,"fn":3494,"description":3495,"org":3566,"tags":3567,"stars":26,"repoUrl":27,"updatedAt":3505},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3568,3569,3570],{"name":3499,"slug":3500,"type":15},{"name":3502,"slug":3503,"type":15},{"name":9,"slug":8,"type":15},{"slug":3507,"name":3507,"fn":3508,"description":3509,"org":3572,"tags":3573,"stars":26,"repoUrl":27,"updatedAt":3523},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3574,3575,3576,3577,3578],{"name":3513,"slug":3514,"type":15},{"name":3516,"slug":3517,"type":15},{"name":17,"slug":18,"type":15},{"name":3520,"slug":3521,"type":15},{"name":9,"slug":8,"type":15},{"slug":3525,"name":3525,"fn":3526,"description":3527,"org":3580,"tags":3581,"stars":26,"repoUrl":27,"updatedAt":3534},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3582,3583,3584,3585],{"name":17,"slug":18,"type":15},{"name":3520,"slug":3521,"type":15},{"name":9,"slug":8,"type":15},{"name":3452,"slug":759,"type":15},{"slug":4,"name":4,"fn":5,"description":6,"org":3587,"tags":3588,"stars":26,"repoUrl":27,"updatedAt":28},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3589,3590,3591,3592,3593],{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":24,"slug":25,"type":15},{"slug":3595,"name":3595,"fn":3596,"description":3597,"org":3598,"tags":3599,"stars":26,"repoUrl":27,"updatedAt":3604},"prisma-next-quickstart","adopt Prisma Next in projects","Adopt Prisma Next into a new project, onto an existing database, or as the first move after a bootstrap tool dropped you into a scaffold. Use for \"what can I do with Prisma Next\", \"what can I do next with Prisma\", \"where do I start\", \"what should I do first\", \"just ran createprisma\", \"createprisma\", \"npx createprisma\", \"npx create-prisma\", \"first steps\", \"first query\", \"I have a scaffolded Prisma Next project what now\"; for `pnpm dlx prisma-next init` greenfield setup; and for `prisma-next contract infer` + `db sign` against an existing database. Also covers the connect-write-read first-arc orientation, the day-to-day commands (`contract emit`, `db init`, `db update`, `migration plan`, `migrate`, `db schema`, `db verify`), and routing to `prisma-next-contract` \u002F `prisma-next-queries` \u002F `prisma-next-runtime` for the next move. Flags: --target, --authoring, --schema-path, --probe-db, --output.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3600,3601,3602,3603],{"name":17,"slug":18,"type":15},{"name":584,"slug":808,"type":15},{"name":9,"slug":8,"type":15},{"name":3452,"slug":759,"type":15},"2026-07-24T05:37:12.462072",{"slug":203,"name":203,"fn":3606,"description":3607,"org":3608,"tags":3609,"stars":26,"repoUrl":27,"updatedAt":3614},"configure Prisma Next runtime and database connections","Wire the Prisma Next runtime — `db.ts` setup using `postgres\u003CContract>(...)` from `@prisma-next\u002Fpostgres\u002Fruntime`, `sqlite\u003CContract>(...)` from `@prisma-next\u002Fsqlite\u002Fruntime`, or `mongo\u003CContract>(...)` from `@prisma-next\u002Fmongo\u002Fruntime`; middleware composition (telemetry from `@prisma-next\u002Fmiddleware-telemetry`; lints and budgets), `DATABASE_URL` config, per-environment branching, switching between Postgres, SQLite, and Mongo façades. Use for db.ts, postgres(), sqlite(), mongo(), middleware, telemetry, lints, budgets, DATABASE_URL, .env, connection pool, poolOptions, dev vs prod config, transactions, db.transaction, read replicas, multi-database, script won't exit, hangs, close connection, db.end, db.close, pool.end, [Symbol.asyncDispose], await using.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3610,3611,3612,3613],{"name":17,"slug":18,"type":15},{"name":13,"slug":14,"type":15},{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},"2026-07-17T05:32:05.347316",{"slug":246,"name":246,"fn":3616,"description":3617,"org":3618,"tags":3619,"stars":26,"repoUrl":27,"updatedAt":3628},"integrate Prisma with Supabase","Use Prisma Next with a Supabase project via `@prisma-next\u002Fextension-supabase` — wire `extensions: [supabasePack]`, declare cross-space FKs to `supabase:auth.AuthUser`, author RLS policies (`policy_select` \u002F `policy_update` \u002F `@@rls`, `auth.uid()` predicates), build `db.ts` with the `supabase()` factory, bind roles per request (`asUser(jwt)` \u002F `asAnon()` \u002F `asServiceRole()`), query `auth.*` \u002F `storage.*` via the `db.asServiceRole().supabase` admin root, and validate JWTs (`jwksUrl` for current projects \u002F `jwtSecret` for legacy HS256). Use for supabase, RLS, row level security, policy, role binding, anon, authenticated, service_role, auth.users, auth.uid(), JWT, JWKS, SUPABASE_JWKS_URL, SUPABASE_JWT_SECRET, SUPABASE.JWT_INVALID, SUPABASE.CONFIG_INVALID, RoleBoundDb, session pooler, supabase:auth.AuthUser, @prisma-next\u002Fextension-supabase.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3620,3622,3623,3624,3625],{"name":3621,"slug":571,"type":15},"Auth",{"name":584,"slug":808,"type":15},{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":3626,"slug":3627,"type":15},"Supabase","supabase","2026-07-30T05:30:11.065251",{"slug":3630,"name":3630,"fn":3631,"description":3632,"org":3633,"tags":3634,"stars":3642,"repoUrl":3643,"updatedAt":3644},"prisma-cli","run Prisma CLI commands","Prisma ORM CLI commands reference covering init, generate, migrate, db, dev, studio, validate, format, debug, and mcp. Use for ORM\u002Fdatabase CLI workflows, not Prisma Compute app deployment. For Prisma Compute, `@prisma\u002Fcli app deploy`, `compute:deploy`, `create-prisma --deploy`, apps, deployments, logs, or domains, use the `prisma-compute` skill instead. Triggers on \"prisma init\", \"prisma generate\", \"prisma migrate\", \"prisma db\", \"prisma studio\", \"prisma mcp\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3635,3638,3639,3640,3641],{"name":3636,"slug":3637,"type":15},"CLI","cli",{"name":17,"slug":18,"type":15},{"name":3520,"slug":3521,"type":15},{"name":584,"slug":808,"type":15},{"name":9,"slug":8,"type":15},44,"https:\u002F\u002Fgithub.com\u002Fprisma\u002Fskills","2026-04-06T18:48:29.140467",21]