I want to have a check constraint to see if the va...
# orm-help
s
I want to have a check constraint to see if the value of a column in a table is in either one of the column of two tables. For example, value of Party in Payments table should either be in the ID column of Sellers table, or ID column of Purchasers table. Is there any way to enforce this in Prisma schema?
r
@Subho 👋 Not possible in the schema directly, but you can use Migrate to achieve this: 1. Create the migration using
prisma migrate dev --create-only
2. Edit the generated
.sql
file and add the check constraint 3. Run
prisma migrate dev
to apply the migration.