prisma-8
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePrisma Next (Prisma 8)
Prisma Next (Prisma 8)
Edit your data contract. Prisma handles the rest.
Prisma Next is a contract-first data layer. This skill routes every Prisma Next task to the right reference file — open the reference before writing code; do not answer from this file alone.
编辑你的数据契约,其余工作由Prisma完成。
Prisma Next是一款契约优先的数据层工具。本技能会将所有Prisma Next相关任务引导至对应的参考文档——在编写代码前请先查看参考文档,不要仅依靠本文档作答。
The canonical model (one paragraph)
标准模型(概述)
You author a data contract (a file, or a TypeScript builder). The framework emits machine-readable artifacts (, ) and gives you two runtime surfaces on SQL targets: a typed SQL query builder () and a typed ORM client (). On MongoDB targets only the ORM lane exists, and its keys are collection storage names () rather than PSL model names — § MongoDB ORM addressing covers the rule. Migrations are planned from the contract diff; you review them, optionally edit the for data transforms, and apply.
contract.prismacontract.jsoncontract.d.tsdb.sql.<ns>.<table>db.orm.<ns>.<Model>db.orm.usersreferences/queries.mdmigration.tsThree steps the user does:
- Edit your data contract. ()
references/contract.md - The system plans the migrations for you. ()
references/migrations.md - If you need data migrations, you edit and execute it. (
migration.ts)references/migrations.md
Everything else — queries, runtime wiring, build integration, debugging, feedback — sits on top of those three.
你需要编写一份数据契约(文件或TypeScript构建器)。框架会生成机器可读的产物(、),并在SQL目标上为你提供两个运行时接口:一个类型化SQL查询构建器()和一个类型化ORM客户端()。针对MongoDB目标仅提供ORM接口,且其键为集合存储名称()而非PSL模型名称——中的 MongoDB ORM寻址 章节介绍了相关规则。迁移会根据契约差异进行规划;你可以审核迁移内容,可选编辑进行数据转换,然后执行迁移。
contract.prismacontract.jsoncontract.d.tsdb.sql.<ns>.<table>db.orm.<ns>.<Model>db.orm.usersreferences/queries.mdmigration.ts用户需要完成的三个步骤:
- 编辑你的数据契约。()
references/contract.md - 系统会为你规划迁移。()
references/migrations.md - 如果需要数据迁移,编辑并执行。(
migration.ts)references/migrations.md
其他所有内容——查询、运行时配置、构建集成、调试、反馈——都是基于这三个步骤展开的。
Routing table
路由表
Open the reference whose triggers match the task. If more than one matches, open each — they are written to compose.
| Task | Reference | Triggers |
|---|---|---|
| Adopt / set up / first steps | | new project, existing database, "what can I do with Prisma Next", "where do I start", "just ran createprisma", |
| Edit the data contract | | schema, models, fields, attributes, relations, indexes, enums, value objects (composite types), type aliases, namespaces (Postgres schemas), cross-contract foreign keys (cross-space FK), polymorphic types ( |
| Author migrations | | |
| Review migrations on deploy | | "what migrations are going to run", "what runs on deploy / merge", merge conflict, diamond convergence, concurrent migrations, migration status, ref management for CI, staging / production environment refs, |
| Write queries | | query, where, select, project, orderBy, take, skip, include, lookup, first, all, count, aggregate, groupBy, create, update, delete, upsert, returning, transaction, |
| Wire the runtime | | |
| Build-tool integration | | Vite plugin ( |
| Supabase | | |
| Debug an error | | any structured error envelope (code, domain, severity, why, fix, meta), emit failed, query won't typecheck, query crashed, migration won't apply, |
| File feedback / ask the team | | bug report, file an issue, feature request, missing feature, capability gap, "this is broken", surprising behaviour, Q&A / design discussion, ask the Prisma team, Prisma Discord (pris.ly/discord), extension-author questions |
打开与任务触发场景匹配的参考文档。如果多个文档匹配,请逐一打开——它们的内容是互补的。
| 任务 | 参考文档 | 触发场景 |
|---|---|---|
| 采用/设置/入门步骤 | | 新项目、现有数据库、“我能用Prisma Next做什么”、“从哪里开始”、“刚运行createprisma”、 |
| 编辑数据契约 | | 模式、模型、字段、属性、关联、索引、枚举、值对象(复合类型)、类型别名、命名空间(Postgres模式)、跨契约外键(跨空间FK)、多态类型( |
| 编写迁移 | | |
| 部署时审核迁移 | | “将运行哪些迁移”、“部署/合并时会运行什么”、合并冲突、菱形收敛、并发迁移、迁移状态、CI的引用管理、预发布/生产环境引用、 |
| 编写查询 | | 查询、where、select、project、orderBy、take、skip、include、lookup、first、all、count、aggregate、groupBy、create、update、delete、upsert、returning、事务、 |
| 配置运行时 | | |
| 构建工具集成 | | Vite插件( |
| Supabase | | |
| 调试错误 | | 任何结构化错误包(代码、领域、严重程度、原因、修复方案、元数据)、生成失败、查询类型检查不通过、查询崩溃、迁移无法执行、 |
| 提交反馈/咨询团队 | | 错误报告、提交Issue、功能请求、缺失功能、功能缺口、“这个功能坏了”、意外行为、问答/设计讨论、咨询Prisma团队、Prisma Discord(pris.ly/discord)、扩展开发者问题 |
Routing rules
路由规则
If the task clearly matches a row, open that reference directly without asking.
For a vague prompt, ask one disambiguating question. Pick from:
- "Are you new to Prisma Next and asking what you can do with it, or where to start?" → (first-touch orientation path).
references/quickstart.md - "Do you want to set up a new Prisma Next project, or wire it into an existing database?" → .
references/quickstart.md - "Do you want to edit your data contract (add a model / field / relation), or work with the database (migrations, queries)?" → vs the others.
references/contract.md - "Is this about authoring a migration, or about reviewing what's going to run on deploy?" → vs
references/migrations.md.references/migration-review.md - "Is this about wiring Prisma Next into your build tool (Vite / Next.js / …), or about wiring and middleware at runtime?" →
db.tsvsreferences/build.md.references/runtime.md - "What error or symptom are you seeing?" → .
references/debug.md - "Do you want to report this as a bug to the Prisma Next team, or is this a feature request?" → .
references/feedback.md
If you still can't tell which reference applies, ask the user what they want to do. Do not guess.
如果任务明确匹配某一行,请直接打开对应的参考文档,无需询问。
对于模糊的请求,提出一个明确的问题。可从以下选项中选择:
- “你是刚接触Prisma Next,想了解它的用途或入门方法吗?” → (首次接触的引导路径)。
references/quickstart.md - “你想搭建一个新的Prisma Next项目,还是将它接入现有数据库?” → 。
references/quickstart.md - “你想编辑数据契约(添加模型/字段/关联),还是操作数据库(迁移、查询)?” → 或其他文档。
references/contract.md - “这是关于编写迁移,还是关于审核部署时将运行的内容?” → 对比
references/migrations.md。references/migration-review.md - “这是关于将Prisma Next集成到构建工具(Vite / Next.js / …),还是关于配置和运行时中间件?” →
db.ts对比references/build.md。references/runtime.md - “你遇到了什么错误或症状?” → 。
references/debug.md - “你想向Prisma Next团队报告这个bug,还是提交功能请求?” → 。
references/feedback.md
如果仍无法确定适用的参考文档,请询问用户的具体需求,不要猜测。
Checklist
检查清单
- If the task matches a routing-table row, open that reference before writing code.
- If the prompt is vague, ask one disambiguating question.
- Do not attempt to answer from this file alone — the references carry the verified tool surface.
- If the user describes a missing feature or a misbehaviour they want fixed, open .
references/feedback.md
- 如果任务匹配路由表中的某一行,编写代码前先打开对应的参考文档。
- 如果请求模糊,提出一个明确的问题。
- 不要仅依靠本文档作答——参考文档包含经过验证的工具接口细节。
- 如果用户描述了缺失的功能或需要修复的异常行为,请打开。
references/feedback.md