docs(orm/next): data modeling guides#8021
Conversation
Add a data modeling section under Prisma Next docs with three pages: - Overview: models, primary keys (how to pick), scalar fields (how to pick a type), and relations - Relational databases: 1:1, 1:n, m:n (implicit + explicit), and polymorphic relations, plus foreign-key ownership guidance - MongoDB: documents, embed-vs-reference, references, and polymorphic collections Register the section in the Next nav. Note: relation snippets use the in-flight directional `@relation(from:, to:)` syntax and implicit m:n from the unmerged PSL relation-syntax stack (prisma/prisma-next #872-876); verify before publishing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🍈 Lychee Link Check Report18 links: ✅ All links are working!Full Statistics Table
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Remove the many-to-many modeling content from the MongoDB guide entirely. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…idance Revision per review feedback, with every schema snippet emit-tested against @prisma-next 0.14.0 (PostgreSQL app + MongoDB app): - Rewrite intros in plain language: idea first, blog example second, terms last. Remove all em dashes. The docs-writer skill gains a "Teach in plain language" section codifying this for other PRs. - Fix syntax that the published packages reject: @relation(from:, to:) does not exist (unsupported argument on 0.14.0 and on main, which accepts fields/references/map/onDelete/onUpdate), so all examples use @relation(fields:, references:). Implicit many-to-many and @relation(through:) are also rejected ("use an explicit join model"), so the m:n section now teaches the explicit junction model as the working pattern and names the implicit form as not supported yet. Verified as PASS: composite @@id junctions, @@discriminator/@@base (both layouts, SQL and Mongo), Mongo type blocks (single + list), uuid()/autoincrement defaults. - Fix broken rendering: bare (1:1) / (1:n) / (m:n) were parsed as remark directives and rendered as "(1\n)". Now backticked; verified intact in rendered HTML. - Break dense guidance into scannable subsections with code blocks: natural vs surrogate keys (Country ISO example, User/Product with @unique), surrogate type choice, data type choice (zip/priceCents/ publishedAt examples), and "Which side owns the foreign key" as an assertive checklist. - MongoDB shown explicitly with tab switchers where it differs (primary keys), cross-links to Fundamentals for querying each shape, "Prompt your coding agent" sections, direct link phrasing. - Park the DR-8679 redirect map, commented out, in next.config.mjs under the shared "Prisma Next URL cutover (DR-8687)" block. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Pushed a revision (b436d39) addressing the review feedback, with every schema snippet emit-tested against Accuracy fixes (tested):
Writing and structure:
Validation: cspell 0 issues, |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…live-tested) Verified against a fresh Prisma Postgres database: variant ORM roots exist and base queries return variant rows, but creating through a variant does not auto-fill the discriminator on 0.14.0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Live-database pass on top of the emit matrix, 2026-07-07: on a fresh Prisma Postgres database, db init applied the page's schemas and the natural-key example works as written (Country create/read by ISO code). Variant models work live with one caveat now noted on the page: variants appear as ORM roots and base queries return variant rows, but creating through a variant needs the discriminator passed explicitly on 0.14.0 (d652e12 adds that sentence). On a local MongoDB replica set, the embedded-type examples run live: creating a user with a nested address returns the document with the embedded object intact. Side note for the CLI team: switching an already-signed database to a different contract via db update -y failed mid-plan on a foreign-key drop ordering (dropTable post before its junction); fresh db init works fine. |
… first Sidebar now reads Data Modeling > Overview / Relational data modeling / MongoDB data modeling, per review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Pushed 291c565: the sidebar now reads Data Modeling as its own section with Overview, Relational data modeling, and MongoDB data modeling as its pages (separator + flattened folder, index retitled Overview; SEO title unchanged via metaTitle). |
What
Adds a Data modeling section under the Prisma Next docs (
/orm/next/data-modeling) with three pages:ObjectId, the embed-vs-reference decision, references, and polymorphic collections.Registers the section in the Next nav (
orm/next/meta.json).Notes for reviewers
Draft. Conceptual guides, not a PSL syntax reference — snippets illustrate the concepts.
@relation(from:, to:)vocabulary and implicit many-to-many from the unmerged PSL relation-syntax stack:These need a re-check against source before publishing.
MongoDB many-to-many is intentionally omitted for now.
Docs forward-reference a "relations reference" and "MongoDB query material" that don't exist yet — those pointers are intentional placeholders.
All PSL was cross-checked against the
prisma/prisma-nextsource rather than prior Prisma syntax.🤖 Generated with Claude Code