ihp icon indicating copy to clipboard operation
ihp copied to clipboard

Create Validation function for UNIQUE constraint over multiple fields

Open jeyj0 opened this issue 3 years ago • 2 comments

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

jeyj0 avatar May 18 '21 08:05 jeyj0

Can I work on this issue?

Swastik2000 avatar Sep 13 '21 05:09 Swastik2000

Yes, of course! Come talk to us here, on the Forum, or in Slack if you run into any issues along the way.

jeyj0 avatar Sep 13 '21 07:09 jeyj0