MAST
MAST
DTDrizzle Team
Created by MAST on 10/19/2024 in #help
Using the drizzle-graphql with custom defined types.
I'm trying to use drizzle-graphql but, it's breaking with this error:
Error: Drizzle-GraphQL Error: Type custom is not implemented!
Error: Drizzle-GraphQL Error: Type custom is not implemented!
I have a couple of custom column types like timerange but, it seems like it's breaking the library. Is there a way I can define custom behavior for these custom types to make it work? P.S. Didn't find a drizzle-graphql tag.
1 replies
DTDrizzle Team
Created by MAST on 8/30/2024 in #help
How to create a reusable query that can receive different select values?
No description
3 replies
DTDrizzle Team
Created by MAST on 9/19/2023 in #help
I have some enum types on a schema, but I can't define it in drizzle-orm.
I have defined a couple of enums in another schema, let's say main. Now I want to define it in drizzle-orm, there's the pgEnum but if I use it, when creating migrations or pushing to the database it'll try to change the table column types from main.enum_name to enum_name which fails. It'll be great if we had something similar to the schema.table but for enums (schema.enum). Also drizzle kit doesn't generate the correct schema because of this. It creates the enums but it doesn't connect them to the correct schema.
1 replies
DTDrizzle Team
Created by MAST on 9/5/2023 in #help
[SOLVED] When running a big bulk insert I get an error, MAX_PARAMETERS_EXCEEDED
I want to run a transaction that runs a large bulk insert but I get this error:
Error: MAX_PARAMETERS_EXCEEDED: Max number of parameters (65534) exceeded
at toBuffer (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:181:20)
at Object.execute (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:167:20)
at Query2.handler2 (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/index.js:256:15)
at Query2.handle (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/query.js:141:65)
Error: MAX_PARAMETERS_EXCEEDED: Max number of parameters (65534) exceeded
at toBuffer (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:181:20)
at Object.execute (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/connection.js:167:20)
at Query2.handler2 (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/index.js:256:15)
at Query2.handle (/home/mast/workspace/work/mix-opt/dev/node_modules/.pnpm/[email protected]/node_modules/postgres/cjs/src/query.js:141:65)
20 replies
DTDrizzle Team
Created by MAST on 8/10/2023 in #help
When using with in relational queries the `orderBy` function is not typed.
23 replies
DTDrizzle Team
Created by MAST on 7/29/2023 in #help
Is there a way to write a query that orders and filters based on an array of possible options?
I'm trying to do some server-side filtering and sorting for a table, and I ended up writing this for the sorting:
const tickets = dbDrizzle.query.ticket.findMany({
orderBy(fields, operators) {
const firstSort = fields[sortBy.data[0]];
const firstDir = operators[sortDirection.data[0].toLowerCase() as 'desc' | 'asc'];
if (sortBy.data.length === 2) {
const secondSort = fields[sortBy.data[1]];
const secondDir = operators[sortDirection.data[1].toLowerCase() as 'desc' | 'asc'];
return and(firstDir(firstSort), secondDir(secondSort));
}

return firstDir(firstSort);
},
});
const tickets = dbDrizzle.query.ticket.findMany({
orderBy(fields, operators) {
const firstSort = fields[sortBy.data[0]];
const firstDir = operators[sortDirection.data[0].toLowerCase() as 'desc' | 'asc'];
if (sortBy.data.length === 2) {
const secondSort = fields[sortBy.data[1]];
const secondDir = operators[sortDirection.data[1].toLowerCase() as 'desc' | 'asc'];
return and(firstDir(firstSort), secondDir(secondSort));
}

return firstDir(firstSort);
},
});
I have typed the sortBy to have the column names for the table in it so when I'm selecting the sort fields it's a union of columns. But the orderBy function errors. Is there a way to do this both for orderBy and where?
1 replies
DTDrizzle Team
Created by MAST on 7/16/2023 in #help
Is there a way to set the index operator type for postgres?
I'm migrating our project to drizzle, and I want to add the indexes to the table. Previously we were using Sequelize and we had an index on a jsonb field with jsonb_path_ops operator. Is there a way to do the same in drizzle?
2 replies
DTDrizzle Team
Created by MAST on 6/14/2023 in #help
Is it possible to tell drizzle which schema to use on the database?
I'm trying to introspect a postgres database with multiple schemas but I want only one of them. Currently drizzle is including only the public schema in the introspect which ends up not being what I want.
2 replies
DTDrizzle Team
Created by MAST on 6/14/2023 in #help
Has anyone done a custom `bytea` column type for postgres?
I'm trying to move our work project to drizzle and the first thing I encountered was the missing bytea column. There was an open issue for it in the github, so I was wondering if someone has already implemented bytea so that I can reuse it 😄
2 replies