feat(client): add initial support for polymorphic relations#29306
feat(client): add initial support for polymorphic relations#29306ian wants to merge 13 commits intoprisma:mainfrom
Conversation
This adds the foundation for polymorphic relations (e.g., item Post | Comment):
- Add isPolymorphic, relationTypes, relationDiscriminator to DMMF types
- Generate union types for polymorphic relation outputs in TS/JS generators
- Add { on: 'Post' } syntax support for include/select filtering
- Handle discriminator-based query routing in runtime
- Add test fixture for polymorphic relations
Note: Schema parser changes in prisma-engines are still needed to
parse the Post | Comment syntax and @polymorphic attribute.
|
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
- Remove reverse relation fields (votes) that require opposite field - Use quoted string for discriminator argument
This adds the foundation for polymorphic relations (e.g., item Post | Comment):
Note: Schema parser changes in prisma-engines are still needed to parse the Post | Comment syntax and
@polymorphicattribute.Example Usage
###Schema
Querying