What's the best practice for selecting an item only if a nullable field is not-null?
type Patient
which has a nullable field called stripeCustomerId
. I create the patient earlier, and when I collect customer information, I add to it.
Although, sometimes, I want to getPatient
but I want it to throw an error if stripeCustomerId
or another similar field is missing. I'd also like to handle errors in my getPatient
function, so I don't have to handle errors everytime I call it.
I created this, but I'm wondering if there's a better way. I'm still a novice....Drizzle produces wrong branded type using Zod
Unable to use db.query... functions
import * as schema from './schema';
import { drizzle } from 'drizzle-orm/...';
const db = drizzle({ schema });
...Nested relation filtering
user table (id, name, role…)
and section table (id, name…)
, bridged by a user_section table (userId, sectionId)
. Hence, a many-to-many relationship.
How can I accomplish in drizzle wherein I query for a section, including users (and its fields) under it, but only users
with the role “Student”
? Right now, I can only filter through userId
and sectionId
in the relational query API (see screenshot)....
Drizzle ORM - Query on the same file
`drizzle-zod` and `z.nativeEnum()`
drizzle-zod
to work with z.nativeEnum
after upgrading - as per the image, if i provide z.nativeEnum
during createSelectSchema
, it overrides all other types generated by drizzle-zod
(see last 4 lines)
[postgres] composite key does not result in constraint creation
${tableName}_pkey
, but in this case when i look on Neon there's no constraint here
```ts
export const preferenceTable = createTable(
'preference',
{...Self referencing composite primary key table
CORS error when trying to open Drizzle Studio with Supabase
query where condition on foreign key relation
sqliteTable is deprecated
Drizzle Kit Schema Diff?
drizzle-zod is not sending custom message upon validation
Driver error callback
Sequence problem with drizzle-seed
Update column ONLY enabled when column is set as NOT NULL #3666
Column not created even though appears in migration file
Unexpected error happened 😕

Drizzle always says data exists even tho it can be undefined in ts.
export const selectRenter = async (name: string) => {
return db.select().from(renter).where(eq(renter.name, name));
};
export const selectRenter = async (name: string) => {
return db.select().from(renter).where(eq(renter.name, name));
};
Is this community still active?