Conditional NotNull Column?

I have a 'users' table. User can have both phone number or email, or either, but both fields can't be null.
I tried adding the following constraint to my table:
sql "CHECK (email IS NOT NULL OR phone_number IS NOT NULL)"

But running into this issue on insert:
https://github.com/drizzle-team/drizzle-orm/issues/2694

Is there a better way to do this?
GitHub
What version of drizzle-orm are you using? 0.32.1 What version of drizzle-kit are you using? 0.23.0 Describe the Bug const files = pgTable("files", { id: uuid("id").primaryKey()...
Was this page helpful?