I am creating a model using Prisma 2 and want to set a minimum and maximum length for one of the fields. I.e., something like this:
model Post {
...
title String @min(3) @max(240)
...
}
I just made up the above syntax. I am wondering if something like that exists in Prisma and, if so, how to do it.
Any ideas?
Thanks.
@db.VarChar
You can set the maximum length using the annotation @db.VarChar
:
model Post {
...
title String @db.VarChar(240)
...
}
There is no support for adding the minimum length as for now.