-
-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
Description and expected behavior
Taken from the examples in the docs I have created a Content model with a viewCount field.
model Content {
id Int @id @default(autoincrement())
name String
createdAt DateTime @default(now())
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
viewCount Int @default(0) @gte(0)
type String
@@delegate(type)
}The viewCount field has an input validator to check if its greater or equal to 0. When trying to create or update the content object, it will properly check (after regenerating the client) the viewCount to match this condition. When using the increment functionality on update, this validation does not happen.
await db.content.update({
where: { id: contentId },
data: {
viewCount: {
increment: incrementBy,
},
},
});Environment (please complete the following information):
- ZenStack version: 3.0.0-beta.24
- Database type: PostgreSQL
Additional context
Is this a known caveat of the Input Validation at ORM level?
Metadata
Metadata
Assignees
Labels
No labels