-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
fix(delegate): generated logical prisma schema has errors when abstra… #1490
Conversation
…ct model is involved
WalkthroughWalkthroughThe changes enhance the handling of inherited fields and relationships in data models. By introducing new methods for traversing inheritance chains and refining logic for processing inherited fields, the updates ensure that polymorphic models with inherited relations are correctly recognized. This resolves issues related to inverse relationships in inherited models. Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant Validator as DataModelValidator
participant Generator as PrismaSchemaGenerator
participant Utils as ast-utils
Validator->>Utils: Call findUpInheritance()
Utils-->>Validator: Return inheritance path
Validator->>Validator: Check if field is inherited
Generator->>Utils: Call findUpMatchingFieldFromDelegate()
Utils-->>Generator: Return base field
Generator->>Generator: Process inherited fields
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- packages/schema/src/language-server/validator/datamodel-validator.ts (3 hunks)
- packages/schema/src/plugins/prisma/schema-generator.ts (2 hunks)
- packages/schema/src/utils/ast-utils.ts (1 hunks)
- tests/regression/tests/issue-1474.test.ts (1 hunks)
Additional comments not posted (4)
tests/regression/tests/issue-1474.test.ts (1)
1-27
: The test case correctly implements the schema for regression testing of issue #1474.packages/schema/src/utils/ast-utils.ts (1)
299-314
: ThefindUpInheritance
function correctly implements the logic to walk up the inheritance chain, aligning with the PR objectives.packages/schema/src/language-server/validator/datamodel-validator.ts (1)
18-18
: The integration ofisFieldInheritedFromDelegateModel
enhances code maintainability by centralizing the inheritance logic.Also applies to: 242-402
packages/schema/src/plugins/prisma/schema-generator.ts (1)
Line range hint
582-664
: ThefindUpMatchingFieldFromDelegate
method and related modifications correctly handle inherited fields and relations in the schema generation process.
Fixes #1474