dgraph
dgraph copied to clipboard
[ENHANCEMENT]: add @unique constraint in GraphQL Schema
Use case and current behavior
GraphQL schema has @id but not unique constraint.
Enhancement
add @unique directive at field level. From : https://github.com/dgraph-io/dgraph/issues/8179
Multiple Uniques or @unique
type User {
id: ID! @id
username: String! @unique
email: String! @unique
}
That would be the equivalent of SQL
ADD CONSTRAINT UNIQUE (username)
ADD CONSTRAINT UNIQUE (email)