-
-
Notifications
You must be signed in to change notification settings - Fork 12
fix: don't inherit inherited map attribute #292
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
Conversation
merge dev to main
merge dev to main (3.0.0-alpha.4)
merge dev to main
merge dev to main (v3.0.0-alpha.6)
merge dev to main
merge dev to main
merge dev to main
merge dev to main
merge dev to main
merge dev to main
merge dev to main
merge dev to main
merge dev to main (v3.0.0-alpha.13)
merge dev to main (v3.0.0-alpha.14)
merge dev to main (v3.0.0-alpha.15)
merge dev to main (v3.0.0-alpha.16)
merge dev to main (v3.0.0-alpha.17)
merge dev to main (v3.0.0-alpha.18)
merge dev to main (v3.0.0-alpha.19)
merge dev to main
merge dev to main (v3.0.0-alpha.21)
merge dev to main (v3.0.0-alpha.22)
merge dev to main (v3.0.0-alpha.23)
merge dev to main (v3.0.0-alpha.24)
merge dev to main (v3.0.0-alpha.25)
merge dev to main (v3.0.0-alpha.26)
merge dev to main (v3.0.0-alpha.27)
merge dev to main
merge dev to main (v3.0.0-alpha.29)
merge dev to main
merge dev to main (v3.0.0-alpha.30)
merge dev to main
merge dev to main
merge dev to main (v3.0.0-alpha.33)
merge dev to main (v3.0.0-beta.1)
merge dev to main
merge dev to main (v3.0.0-beta.2)
merge dev to main (v3.0.0-beta.3)
merge dev to main (v3.0.0-beta.4)
merge dev to main
merge dev to main (v3.0.0-beta.6)
merge dev to main (v3.0.0-beta.7)
merge dev to main (v3.0.0-beta.8)
WalkthroughThe PrismaSchemaGenerator now filters model attributes to exclude inherited @@Map attributes from base models. A new private helper, isInheritedMapAttribute, detects map attributes originating from a different container. Attribute generation uses this guard to include only Prisma attributes relevant to the current model context. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
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)
packages/sdk/src/prisma/prisma-schema-generator.ts (1)
190-197: Implementation correctly identifies inherited@@mapattributes.The logic properly checks if an attribute is inherited (different container) and is specifically a
@@mapattribute. The nullish coalescing operator safely handles cases where the reference is unresolved.Consider adding JSDoc to explain why only
@@mapis filtered among inherited attributes:+ /** + * Checks if an attribute is an inherited @@map attribute. + * @@map attributes define table names and should not be inherited + * from base models, as each model should have its own table mapping. + */ private isInheritedMapAttribute(attr: DataModelAttribute, contextModel: DataModel) {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/sdk/src/prisma/prisma-schema-generator.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{packages,samples,tests}/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place packages only under
packages/,samples/, ortests/
Files:
packages/sdk/src/prisma/prisma-schema-generator.ts
🧬 Code graph analysis (1)
packages/sdk/src/prisma/prisma-schema-generator.ts (2)
packages/language/src/generated/ast.ts (4)
DataModelAttribute(395-400)DataModelAttribute(402-402)DataModel(377-387)DataModel(389-389)packages/language/src/ast.ts (1)
DataModel(49-54)
🔇 Additional comments (1)
packages/sdk/src/prisma/prisma-schema-generator.ts (1)
174-176: Filtering logic correctly excludes inherited@@map; no other inherited model-level attributes detected.
ymc9
left a comment
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.
LGTM! Thanks for making the fix, @dhritcu
Resolves #291
Summary by CodeRabbit