digitallyinduced/ihp

Create Validation function for UNIQUE constraint over multiple fields

オープン

#877 opened on 2021/05/18

 (2 件のコメント) (0 件のリアクション) (1 人の担当者)Haskell (221 件のフォーク)batch import
enhancementgood first issue

Repository metrics

Stars
 (5,285 個のスター)
PR merge metrics
 (平均マージ 11h 20m) (30d で 21 merged PRs)

説明

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

コントリビューターガイド