Reputation: 25770
I know how to create an index on the relationship property in Neo4j:
CREATE INDEX IF NOT EXISTS FOR ()-[r:CONTAINS]-() ON (r.uuid)
but how to add UNIQUE
constraint to r.uuid
there?
Upvotes: 2
Views: 526
Reputation: 16033
EDIT: According to Michael Hunger from neo4j and stdob--, this is not yet possible.
**
I can't check it, since I don't have the Enterprise edition,
but If I combine the docs example for Unique node property constraints:
CREATE CONSTRAINT constraint_name FOR (book:Book) REQUIRE book.isbn IS UNIQUE
With the docs example for Relationship property existence constraints:
CREATE CONSTRAINT constraint_name FOR ()-[like:LIKED]-() REQUIRE like.day IS NOT NULL
I can only assume that when it is possible, its syntax will be:
CREATE CONSTRAINT constraint_name FOR ()-[r:CONTAINS]-() REQUIRE r.uuid IS UNIQUE
Upvotes: 1