PrismaP
Prisma12mo ago
3 replies
layhodib

Nullable Datetime Field

hello i'm trying to create a field last_purchase_date but there's a case where user has not purchased yet so i want the field to be null.

this is what i have in schema.prisma
model Item {
  last_purchase_date DateTime?
}


and this seems to work, the field can be null, but when i try to query it with prisma i get this error.
Error converting field "last_purchase_date" of expected non-nullable type "DateTime", found incompatible value of "null"
Was this page helpful?