user3560165
user3560165

Reputation: 33

Constraints in neo4j-properties file

Is there a way to define constraints in the neo config file (e.g. neo4j-properties) similarly to defining auto-indexing instead of having to use cypher queries? How does the syntax look like for say:

CREATE CONSTRAINT ON (u:User) ASSERT u.user_id IS UNIQUE

I couldn't find any documentation about this. Thanks a lot!

Upvotes: 0

Views: 65

Answers (2)

synthomat
synthomat

Reputation: 774

As of Neo4j 2.0 auto indexing is considered as a legacy feature and should not be used anymore. Use schema to define your indices and constraints instead.

(See http://docs.neo4j.org/chunked/milestone/indexing.html)

Upvotes: 1

Eve Freeman
Eve Freeman

Reputation: 33175

Nope, you can't do this AFAIK. I usually just write a script and invoke it with neo4j-shell -file, or build a system to manage this in the app I'm working on.

Upvotes: 1

Related Questions