Fix schema generation for prisma preview feature - fullTextSearch #62
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.
Hi @omar-dulaimi, thanks for creating this awesome project. I would like to integrate a fix that is related to prisma preview feature.
References
https://www.prisma.io/docs/concepts/components/prisma-client/full-text-search
Description
If we use
![Screenshot from 2022-12-08 20-01-02](https://user-images.githubusercontent.com/62707100/206466783-43a9e3a8-ef27-4027-9a9b-cf784f9b2dba.png)
![Screenshot from 2022-12-08 20-02-00](https://user-images.githubusercontent.com/62707100/206466809-6183bbdf-bc4f-4b58-a271-f1a955774dba.png)
fullTextSearch
(one of the preview features prisma offers) withMySQL
orPostgreSQL
, then prisma exportsUserOrderByWithRelationAndSearchRelevanceInputObjectSchema
instead ofUserOrderByWithRelationInputObjectSchema
.But in the transformer class while generating model schemas, currently we statically import the
UserOrderByWithRelationInputObjectSchema
. So I have added a resolve function that will return an import and zod-schema-line(like we do for include and select field) for orderBy field.