PrismaP
Prisma2y ago
6 replies
fjuk

Unique index w/ nullable field in unique query

I'm having an issue with a unique index where one of the fields is a nullable field (deleted at)

When attempting to findUnique or upsert with the unique index, I'm unable to use it with the value of null (which should get me the only row that's not deleted if there's one). Instead, it errors, saying that the value must not be null and must be a proper date

I'm not really sure how to go around this, since I can't separate the where clause to name and deletedAt since I'm required to use unique field(s)
Was this page helpful?