Home > Mobile >  Only allow text field to contain certain string values
Only allow text field to contain certain string values

Time:09-18

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?

CodePudding user response:

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

  • Related