Ecto - check_constraint - field param for table constraints?

If I have a table constraint that involves multiple fields, what should I be entering in the field argument in Ecto changeset’s check_constraint function? Should one just arbitrary pick any column name or pass in the table name instead?

From what I know, a check constraint must be on a single field. Maybe you have another type of constraint that isn’t a check constraint. Could you show how your constraint is defined in your migration?


Sorry I was wrong that limitation doesn’t exist. From the source code it seems like you can pick any column you want and the error will be put there in the changeset.

1 Like

Given errors in a changeset are stored per field you need to decide which field to add an error to if the constraint is triggered.