3 ms·
Type-safe query builders sound great in theory, but it seems there are always edge cases that are not supported by the query builder. For example, the issue as
by solatic 2y ago
Type-safe query builders sound great in theory, but it seems there are always edge cases that are not supported by the query builder.
For example, the issue asking for deferrable constraint support for Postgres in drizzle has been open for about a year: https://github.com/drizzle-team/drizzle-orm/issues/1429 https://github.com/drizzle-team/drizzle-orm/issues/1429
In any non-trivial application, you are increasingly likely to run into something that your database supports but your query-builder does not. What will you do then?
It's sad, but unfortunately the most reliable approach seems to be to write raw SQL in a DAO package/library, then using integration tests (DAO + database) to confirm behavior.
- s4i 2y agoThis is the reason I find it odd that most of these tools require their own system/DSL for defining the schema and the migrations. Using vanilla SQL DDL for that part gives you more escape hatches. This is possible with e.g. kysely + kysely-codegen.
- lf-non 2y agoJust because some edge cases aren't supported, doesn't mean you can't take advantage of the type-safety in the rest of the application. This particular feature seems to have nothing to do with the query builder even, just the migration system. You can always write just those specific migrations manually.