digitallyinduced/ihp

Create Validation function for UNIQUE constraint over multiple fields

開放

#877 建立於 2021年5月18日

 (2 則留言) (0 個反應) (1 位負責人)Haskell (221 個分叉)batch import
enhancementgood first issue

倉庫指標

星標
 (5,285 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南