-
Notifications
You must be signed in to change notification settings - Fork 870
docs: add mapped enums breaking change to Prisma 7 upgrade guide #7401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add mapped enums breaking change to Prisma 7 upgrade guide #7401
Conversation
WalkthroughAdds documentation across multiple docs pages and an AI prompt: documents that Prisma v7 emits TypeScript enum values from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related issues
Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
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 |
Dangerous URL checkNo absolute URLs to prisma.io/docs found. |
Redirect checkThis PR probably requires the following redirects to be added to static/_redirects:
|
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/350-ai-tools/100-cursor.mdx
Errors in 800-guides/380-vercel-app-deployment.mdx
|
Deploying docs with
|
| Latest commit: |
ed2b69d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://19f2c26f.docs-51g.pages.dev |
| Branch Preview URL: | https://dr-6654-ensure-documentation.docs-51g.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx (1)
345-409: Well-structured documentation with appropriate warning placement.The section effectively communicates the breaking change with:
- Prominent warning block about the known bug
- Clear before/after code examples
- Practical workarounds
The content is consistent with the AI prompt documentation (content/900-ai/prompts/prisma-7.mdx), which is important for maintaining coherent guidance across the docs.
One optional enhancement: Consider briefly explaining why this change was made (e.g., "to better align generated types with actual database values") to help users understand the long-term benefit despite the current bug.
Optional: Add context for the change rationale
After line 353, you could optionally add:
In Prisma ORM v7, the generated TypeScript enum values now use the `@map` values instead of the schema names. This is a breaking change from v6. + +This change aligns the generated TypeScript enum values with the actual values stored in your database, making the generated code more intuitive when working with database queries and results.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx(1 hunks)content/900-ai/prompts/prisma-7.mdx(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Check internal links
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
content/900-ai/prompts/prisma-7.mdx (2)
372-372: Good addition to the deliverables checklist.Including the mapped enum warning in the deliverables list ensures AI assistants will check for and communicate this breaking change when applicable.
305-360: Verify GitHub issue #28591 and its current status before relying on this documentation.The section effectively documents the mapped enum breaking change with clear before/after examples and identifies the known bug. However, GitHub issue #28591 exists but the documentation should note its current resolution status—whether it remains unfixed, has a timeline for resolution, or if users should be aware of any updates to the workarounds since v7.2.0.
...ent/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx
Outdated
Show resolved
Hide resolved
...ent/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx
Outdated
Show resolved
Hide resolved
…ions/400-upgrading-to-prisma-7.mdx Co-authored-by: Ankur Datta <[email protected]>
9be02b3
...ent/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx
Outdated
Show resolved
Hide resolved
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/300-upgrade-guides/800-upgrade-from-prisma-1/06-upgrading-prisma-binding-to-sdl-first.mdx
Errors in 200-orm/800-more/350-ai-tools/100-cursor.mdx
Errors in 800-guides/380-vercel-app-deployment.mdx
|
…ions/400-upgrading-to-prisma-7.mdx Co-authored-by: Ankur Datta <[email protected]>
...ent/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx
Outdated
Show resolved
Hide resolved
...ent/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx
Outdated
Show resolved
Hide resolved
...ent/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx
Outdated
Show resolved
Hide resolved
Co-authored-by: Ankur Datta <[email protected]>
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/350-ai-tools/100-cursor.mdx
Errors in 800-guides/380-vercel-app-deployment.mdx
|
Co-authored-by: Ankur Datta <[email protected]>
Co-authored-by: Ankur Datta <[email protected]>
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/350-ai-tools/100-cursor.mdx
Errors in 800-guides/380-vercel-app-deployment.mdx
|
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/350-ai-tools/100-cursor.mdx
Errors in 800-guides/380-vercel-app-deployment.mdx
|
…ped-enums-implementation
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/350-ai-tools/100-cursor.mdx
Errors in 800-guides/380-vercel-app-deployment.mdx
|
🍈 Lychee Link Check Report
📊 Results Overview
Errors per inputErrors in 200-orm/800-more/350-ai-tools/100-cursor.mdx
Errors in 800-guides/380-vercel-app-deployment.mdx
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
content/200-orm/500-reference/100-prisma-schema-reference.mdx (1)
2725-2740: Consider document structure: v7-specific behavior within general attribute docs.The content accurately documents the v7 mapped enum behavior and includes an appropriate warning about the runtime bug. The code example is correct, and the cross-reference to the upgrade guide is helpful.
However, this v7-specific breaking change documentation is embedded within the general
@mapattribute reference documentation. This placement might create confusion for users in two scenarios:
- Users still on v6 reading about
@mapwho don't need v7 migration information yet- Users searching for general
@mapbehavior who encounter version-specific migration contentConsider adding a version indicator in the heading or structuring this as a versioned callout (e.g., "In Prisma ORM v7:") to make it clear this is version-specific behavior rather than general
@mapattribute documentation.The warning about the known bug is appropriately worded and links to the right resources.
content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx (1)
395-427: Clarify trade-offs between the two workaround approaches.The section provides two valid workarounds, but doesn't explicitly guide users on when to choose one over the other. Consider adding a brief comparison to help users make an informed decision:
Workaround 1 (string literal with
as any): Maintains your existing database schema but requires type assertions throughout your codebase. Use this if you need to preserve the exact database enum values (e.g., for compatibility with existing data or external systems).Workaround 2 (removing
@map): Cleaner TypeScript but requires a database migration to change enum values. Use this if you can safely migrate your database and prefer type-safe code without assertions.Additionally, the first workaround might trigger TypeScript linting rules against
anytypes. Consider mentioning an alternative using type assertions:await prisma.suggestion.create({ data: { status: "PENDING" as unknown as SuggestionStatus.PENDING, }, });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
content/200-orm/100-prisma-schema/20-data-model/50-database-mapping.mdx(1 hunks)content/200-orm/500-reference/100-prisma-schema-reference.mdx(1 hunks)content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx(1 hunks)content/900-ai/prompts/prisma-7.mdx(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- content/200-orm/100-prisma-schema/20-data-model/50-database-mapping.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- content/900-ai/prompts/prisma-7.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Check internal links
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
content/200-orm/800-more/300-upgrade-guides/200-upgrading-versions/400-upgrading-to-prisma-7.mdx (2)
345-351: LGTM: Clear warning about runtime bug.The section heading clearly identifies the breaking change, and the warning is appropriately prominent. The explanation of the mismatch between TypeScript types (expecting mapped values) and the Prisma Client engine (expecting schema names) helps users understand the root cause of runtime errors.
The GitHub issue link provides transparency and allows users to track resolution progress.
353-389: Excellent before/after comparison demonstrates the breaking change.The side-by-side comparison using the same
SuggestionStatusenum makes the breaking change immediately clear. Showing thatSuggestionStatus.PENDINGchanges from"PENDING"(v6) to"pending"(v7) effectively illustrates the impact.The consistent use of the same schema example in both sections allows readers to focus on the difference in generated output rather than understanding different schemas.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.