TRCPClientError when creating an entry with blank `updatedAt`

Guys, this is my prisma schema:
model User {
id Int @id @default(autoincrement())
firstName String?
lastName String?
email String @unique
phone String?
about String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model User {
id Int @id @default(autoincrement())
firstName String?
lastName String?
email String @unique
phone String?
about String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
Every time I try to create an entry, it fails because I didn't provide a value for updatedAt. How to fix?
TRPCClientError:
Invalid `prisma.user.create()` invocation:
Null constraint violation on the fields: (`updatedAt`)
TRPCClientError:
Invalid `prisma.user.create()` invocation:
Null constraint violation on the fields: (`updatedAt`)
Thanks!
2 Replies
Sebastian
Sebastian2y ago
You can use the @updatedAt directive for letting prisma correctly handling it
bassamanator
bassamanatorOP2y ago
@sebi Sorry, is this some extra code that I have to right? My model includes @updatedAt, is it incorrect? My db is postgresql.
Want results from more Discord servers?
Add your server