fix(psl): retrieve all referential actions based on relationMode#4844
Merged
fix(psl): retrieve all referential actions based on relationMode#4844
Conversation
Contributor
WASM Query Engine file Size
|
Contributor
Author
|
Somehow we didn't have a test for this in language-tools or in engines so I've added one here using the schema defined in the issue |
Druue
commented
Apr 29, 2024
...ests/text_document_completion/scenarios/referential_actions_relation_mode_prisma/result.json
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #4844 will not alter performanceComparing Summary
|
Contributor
✅ WASM query-engine performance won't change substantially (0.997x)Full benchmark reportAfter changes in bd1a681 |
janpio
reviewed
Apr 29, 2024
Contributor
Author
|
Test Results: Which lines up with the following table from our Referential Actions Docs |
jkomyno
approved these changes
Apr 30, 2024
Contributor
jkomyno
left a comment
There was a problem hiding this comment.
Thanks for addressing the change requests. Looks good!
added 3 commits
April 30, 2024 16:30
…keys add new referential_actions fn that matches on relation_mode and defers to the FK / emulated actions
80843b2 to
bd1a681
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The idea was to use
referential_actionsfor retrieving the list of referential actions in the default SQL case (relationMode = "foreignKeys"). Once MongoDB + PlanetScale support was required, we addedemulated_referential_actions(only valid whenrelationMode = "prisma").We ran into an issue where we were only using
referential_actionsi.e. only for SQL FKs in prisma-fmt and therefore missing out on completions for referential actions specific torelationMode = "prisma", or in MongoDB's case, we didn't retrieve any.So this PR renames
referential_actionsintoforeign_key_referential_actionsand adds a newreferential_actions(&self, relation_mode: RelationMode) -> BitFlags<ReferentialAction>method to help us avoid similar confusion in the futurefixes prisma/language-tools#1676
Context: Slack.