neo4j-graphql-js icon indicating copy to clipboard operation
neo4j-graphql-js copied to clipboard

Need uniqueness schema constraint with @unique directive

Open benjamin-rood opened this issue 6 years ago • 2 comments

The library needs a way of implementing all Neo4j database constraints in order for the GraphQL schema to correctly function as the definitive 'schema' for a project.

Uniqueness is the best place to start, and the @unique schema directive is a quite common idiom.

ref: https://neo4j.com/docs/cypher-manual/current/schema/constraints/#query-constraint-unique-nodes

I would like to implement node property uniqueness in a GraphQL schema via the @unique directive at the end of a property definition.

e.g.

type Book { 
  isbn: ISBN! @unique
  title: String!
  ...
}

The @unique directive here should be equivalent to CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE

@johnymontana Any suggestions on how to best implement this?

benjamin-rood avatar Jul 01 '19 08:07 benjamin-rood

Duplicate of #137

johnymontana avatar Jul 10 '19 16:07 johnymontana

https://github.com/neo4j-graphql/neo4j-graphql-js/issues/608

michaeldgraham avatar May 02 '21 04:05 michaeldgraham