Suji
DTDrizzle Team
•Created by Suji on 2/23/2024 in #help
Undo Migration
Is there a way to undo a generated migration, not dropping the migration from the migration table but undo the schema changes applied from a migration like in sequalize ?
1 replies
DTDrizzle Team
•Created by Suji on 1/27/2024 in #help
Help with types relational query function
I've created a function that i use to paginate data with relations, removed all the paginating stuff for the post
right now this works, but the problem is i have to define the relations twice, once as a param for the generic type and again for the with parameter
This is what ive done, im not sure why this doesn't yield the same results
Above change causes to miss the relational types in the return type 😦
Any TS aficionados willing to help 🙂
28 replies
DTDrizzle Team
•Created by Suji on 9/9/2023 in #help
Get raw query from toSQL
I trying to figure out if drizzle has a function or helper built in that builds the raw query returned from toSQL
right now toSQL returns params and sql as an object, i would like to get the raw sql query
this is what im doing now to achieve this, any alternatives or is there a something drizzle provides i missed thanks
8 replies
DTDrizzle Team
•Created by Suji on 6/1/2023 in #help
Infer return type for relational query with pagination
I have created a function that can paginate data for relational queries, problem is i cant figure out how to make to include the relations that are passed into the inferred return type
returnType is typed with only the base table fields, this doenst include the fields that get included from relations. Any clues or pointers ??
3 replies
DTDrizzle Team
•Created by Suji on 5/30/2023 in #help
can you Infer relations?
im really loving how drizzle plays well with relations, but im wondering is there a way to get types for relations?
in prisma you can use
Prisma.YourModelGetPayload<{}>
to generate a type with relations, is this possible with infermodel?
i tired the most obvious way and that didnt work
4 replies
DTDrizzle Team
•Created by Suji on 5/29/2023 in #help
Doent infer type in Callback syntax for query
Im querying the users table like this
db.query.user.findFirst({
where: (user, { eq }) => {
return eq(user.email, whereArgs?.email);
},
})
in the where callback param user is typed as never ??
ive setup drizzle like this
import * as schema from '@/db/schema';
const db = drizzle(pool, { schema });
any idea why this is the case??2 replies