dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

[ENHANCEMENT]: Add Composite unique constraint in GraphQL schema

Open rderbier opened this issue 1 year ago • 0 comments

Use case and current behavior

GraphQL object can have an @id field but not constraints on a set of unique values.

Enhancement

From : https://github.com/dgraph-io/dgraph/issues/8179

Composite Uniques or @unique

type User @unique(fields: ["firstName", "lastName"]) {
  email: String!
  firstName: String!
  lastName: String!
  ...
}

Would be the equivalent of SQL constraint:

ADD CONSTRAINT UNIQUE (firstName, lastName)

rderbier avatar Jun 09 '23 18:06 rderbier