bassamanator
bassamanatorβ€’2y ago

TRPCClientError when creating a db entry without `updatedAt` value?

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! Using t3-app.
Solution:
this is a prisma question not a trpc one. based on the error sounds like you need to provide a value for updatedAt
Jump to solution
4 Replies
Solution
trash
trashβ€’2y ago
this is a prisma question not a trpc one. based on the error sounds like you need to provide a value for updatedAt
bassamanator
bassamanatorOPβ€’2y ago
@trash_dev Interestingly enough, I'm watching your tRPC tutorial on youtube lol. Sorry about this post. Thanks!
trash
trashβ€’2y ago
haha awesome! hope it’s helpful πŸ™‚
bassamanator
bassamanatorOPβ€’2y ago
Very, thanks!