prisma / prisma-engines

🚂 Engine components of Prisma ORM
https://www.prisma.io/docs/concepts/components/prisma-engines
Apache License 2.0
1.17k stars 227 forks source link

Improve the query schema builder #2494

Open garrensmith opened 2 years ago

garrensmith commented 2 years ago

The current query schema and the builder are a direct port from the original scala code. Given the teams improved knowledge of rust and how we are using the schema, we can improve on the original design and make it a little more rust-like.

At this point I don't have a very clear path on how we would do, but some of the ideas I have are:

An approach to implementing this could be something like:

  1. Chat to the query engine team for general ideas and thoughts on a new design
  2. Implement a very rough POC that tests out some of the ideas we would want to implement
  3. Depending on the POC either rewrite the schema builder in one go or start rewriting smaller parts of it in the new design
tomhoule commented 2 years ago

Not in my domain but I just wanted to chime in on the walker pattern. We've been using it more and more in migrations team parts of the codebase, and we've refined it in the process. The best example (and the most recent) IMO is the walkers from parser-database. They're used heavily in the validations in datamodel core and the general opinion is that it's much nicer to work with than previous solutions.

tomhoule commented 2 years ago

Public API for the parser database walkers: https://prisma.github.io/prisma-engines/doc/parser_database/walkers/index.html