Only allow text field to contain certain string values

Viewed 30

I'm new to Prisma - I'm using it with a PostgreSQL database.

I have a table in my database that has a string field - I'd like, if possible, for that string field to only accept certain values: for example, "foo" and "bar", and if someone tried to insert any other string, e.g. "blah", it wouldn't be accepted.

Is this possible?

1 Answers

This is possible using the Prisma enum API, check the docs to see how to properly use it for your requirement

Related