ykisana
DTDrizzle Team
•Created by ykisana on 10/19/2024 in #help
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?1 replies
DTDrizzle Team
•Created by ykisana on 8/16/2024 in #help
table with multiple possible one-to-many relation, but not many-to-many
I have an image table which looks like this, it has many possible one-to-many relationships, ie. room, profile and feedback can have many images.
The issue is, I want the image to have only one relation at a time. So I don't want it to be possible for image to have both roomId and feedbackId as not null.
Want to know if this is possible. Also is there a better way to do images? How would you do tables for a relation like this?
1 replies