tc
tc
DTDrizzle Team
Created by tc on 11/5/2024 in #help
Using relation columns in where clause (Drizzle playground provided)
I have a one-to-one relationship with a schema defined like: https://drizzle.run/uwkkt8l10cgp5okr1r41tjfu When I run that query, I get the following error column agent.deleted does not exist. Why can't you reference relation columns in a top-level where clause? Is there a better way to do this without using the select API with joins?
11 replies
DTDrizzle Team
Created by tc on 1/10/2024 in #help
Why can't you use `with` with FK relations?
I'd like to be able to use the query builder with to get relations defined by FK constraints. I feel like this should be available by default, rather than having to specify every possible relation that is already defined by FKs. I understand that this is an opt-in feature and you can define relations outside the scope of standard DB mechanisms, but FKs are used to formally define and enforce relations in the DB and (imo) should be automatically applied to the relations. Is the only way to accomplish this to define "relations" for all of these? Appreciate the insight and have been really enjoying the experience transitioning from Prisma to Drizzle so far! 🙏
3 replies
DTDrizzle Team
Created by tc on 11/6/2023 in #help
drizzle-zod with custom types
I have defined opaque types in my application and have implemented those in the drizzle schema (awesome and easy to use!). The opaque types are defined using zods Brand feature i.e. z.string().uuid().brand<"SomeId">(); I have that defined in the drizzle schema as someId: uuid("id").$type<SomeId>().notNull() When I use drizzle-zod to create the schema and infer the type, it's coming back as a z.ZodString rather than z.ZodBranded. Is this a bug, a feature that is in development, or simply not supported and I need to override these types?
5 replies