PrismaP
Prisma2y ago
1 reply
Rev

Optimistic Locking in prisma

There is any way to define that a field in database is the locking and automatically validate?
Example:

model User {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
version Int @Version
}

and every time that i need to update the table user i need to send the version and the prisma automatically validate if version is the same else throw an exception
Was this page helpful?