DT
Drizzle Teamforeach2845
How to get InferModel to work with Relation model?
Is there a way to get the infer type for a relation model? eg:
type User = InferModel<typeof users, "select">;
type UserWithPosts = InferModel<typeof users, { posts: true }, "select" >;
M
mcgrealife•350d ago
@foreach
I'm not sure if there is a specific helper to InferModel with types from relations (that looks like a clean syntax you propose though ^), but in case you are attempting to infer the type of a relation query, it's possible to wrap the query in a function and Infer the ReturnType of that https://discord.com/channels/1043890932593987624/1112458428070236229/1112519441561956352
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.4KMembers
View on DiscordWant results from more Discord servers?
More PostsMySQL column type: "Generated"?Does drizzle support defining generated columns? https://planetscale.com/courses/mysql-for-developeAnyone else having a weird issue with drizzle-kit push:mysql?I spun up a new project using Planetscale and I got a bizarre __vtschema error (see: https://github.Performance questionsI'm using Drizzle ORM with Planetscale DatabaseJS driver and my application has spots where I want tCan drizzle generate an initial schema from an existing db?I have a db that wasn't built using drizzle, but I'm interesting in moving over to it. Do I need to