ihp
ihp copied to clipboard
Create Validation function for UNIQUE constraint over multiple fields
We are currently only able to validate that a single field is unique in its table. However, there are use-cases in which a pair or more of attributes should be unique inside the table. In SQL this can be expressed using a constraint such as:
ALTER TABLE recipes ADD CONSTRAINT recipes_unique_name_in_group UNIQUE (group_id, name);
It would be good if we had a function similar to validateIsUnique
that validates this constraint.
Naming suggestions:
-
validateAreUnique
-
validateIsUniqueComposite
-
validateAreUniqueFields
-
validateIsUniqueSet
Can I work on this issue?
Yes, of course! Come talk to us here, on the Forum, or in Slack if you run into any issues along the way.