ptrxyz
Explore posts from serversPPrisma
•Created by ptrxyz on 1/28/2025 in #help-and-questions
type-safely wrapping `findMany`
I am trying to wrap the
findMany
function in a separate function.
Can someone help me to get this right:
So my trail of thought was to make it similar to a client extension (which is not what I want. I would like the function presented to be correctly typed) yet I do not have the this
property to work with. So I ended using Prisma.Args
to describe the shape of input args that I want and Prisma.Exact
to narrow A
down to Prisma.Args<T, 'findMany'>
. This leads to args
being rejected as valid for prisma.assignment.findMany
So I get this error if I use Prisma.Exact
for args
As a 2nd problem, I can't get the return type right. the return prisma.assignment...
statement has red squiqqly lines with TS complaining:
So apparently I get everything wrong and I can't figure out how this should work. Does anyone know how to make it so that my personal wrapper exactly type-safely mirrors the type/shape/behavior of prisma.assignment.findMany
?10 replies
PPrisma
•Created by ptrxyz on 9/24/2024 in #help-and-questions
concat two Prisma.sql queries.
I have two pretty complex queries which i created manually using
In some cases and since both return the same data type, I would like to run them in one go concatenated using
(QUERY1) UNION (QUERY2)
.
So, my question is: How can I concat two Prisma.sql
queries?8 replies
PPrisma
•Created by ptrxyz on 3/17/2024 in #help-and-questions
Multiple Prisma clients and connection pooling
I would like to use multiple Prisma clients in my application, basically like so:
I wonder if they share the same connection pool and when they connect to the database. Does Prisma connect on first query or as soon as you create the client? And in my example, do p1 and p2 connect separately and keep different connection pools or do they share the same underlying pool since they both use the same configuration?
2 replies
DTDrizzle Team
•Created by ptrxyz on 9/17/2023 in #help
TIMESTAMPTZ is returned as string instead of Date object

9 replies
DTDrizzle Team
•Created by ptrxyz on 9/15/2023 in #help
Migrating from Prisma Schema
I want to migrate away from Prisma, but I can't seem to find a good way to get the schema right:
- Drizzle's introspect feature somehow generates garbage with VARCHARs deafult values, I saw that this seems to be a known issue on GitHub, so I suppose there is nothign I can do about that?
- Then, while 1:1 relations seem to be covered, I can't get it to generate any (many:many) relations. How is that done by Drizzle? Does it use some kind of heuristics to detect relations? Our company's model has roughly 100 tables and for now we used Prisma to handle it, so we have a prisma schema in case that helps anything, but managing all relations manually is probably error prone and a bit of a problem.
- Kysely has a nice generator to generate types from a Prisma schema. Can Drizzle also do that?
5 replies
Getting free disk space without using child_process.
Hello everyone!
I would like to create a small CLI tool using Typescript and Deno. I would like to monitor the free disk space on several disks.
How can I get the free disk space on a Linux machine without forking a separate process (like
exec --> df
and the like)?
In addition, I would like to deno compile
my little program later, so I am not sure if Node's gyp is an option then.9 replies