Can I set a UNIQUE constraint with a conditional?

I need to ensure uniqueness in an attribute but this attribute can be NULL. A simple .unique in my schema does not work in a sqlite database. My goal is to achieve the equivalent of CREATE UNIQUE INDEX unique_product_barcode_not_null ON products(barCode) WHERE barCode IS NOT NULL; using the Drizzle schema api.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?