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?
}
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"
Error converting field "last_purchase_date" of expected non-nullable type "DateTime", found incompatible value of "null"
3 Replies
Prisma AI Help
You decided to hold for human wisdom. We'll chime in soon! Meanwhile, #ask-ai is there if you need a quick second opinion.
layhodib
layhodibOP4w ago
It’s working now, I believe I just needed to rerun ‘npm run dev’
Nurul
Nurul4w ago
Glad to hear that its working 👍

Did you find this page helpful?