Skip to content
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

[Proposal] pg_trgm Support #3

Closed
DavidHancu opened this issue Sep 14, 2022 · 2 comments
Closed

[Proposal] pg_trgm Support #3

DavidHancu opened this issue Sep 14, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@DavidHancu
Copy link
Owner

pg_trgm Support

Hey everyone! I've recently seen an issue in the official Prisma GitHub repository asking for pg_trgm support, then encountered the same necessity with my use-cases of Prisma, so I thought about implementing it in Prisma Util.

Design

As all features that modify the way that Prisma Util processes files, this feature will be marked as Experimental as well (or opt-in if you will). To get started, you'd need to add the following to your configuration file (using the new .mjs syntax coming in v1.3.0):

{
    pg_trgm: true,
    ftsIndexes: {
        "schema.prisma:User.name": "GIN"
    }
}

In this case, Prisma Util will create a GIN index for the model User in the file named schema.prisma for the name column.

Implementation

Prisma Util is already capable of enhanced parsing, so my idea was to add an @Unsupported("TSVECTOR") field to the schema, as well as install pg_trgm and create GIN or GiST (configured per field via the configuration file) indexes.

Code

This is the biggest problem right now and I'd love some feedback on how you'd want this feature to operate. I would say that a middleware is best, as it requires the least amount of setup and it's pretty easy to implement as well.

Wrapping Up

Please let me know what you expect from this feature and how you think that it should be used.

@DavidHancu
Copy link
Owner Author

Implemented in v1.3.0.

@pencilcheck
Copy link

pencilcheck commented Jan 22, 2023

Is there a doc on how to use this? Came here from the other issue on prisma

hmm, saw it is deprecated that is implemented on prisma, but i wonder if it works for mysql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants