Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

neo4j how to drop all constraints

Tags:

Is there a cypher command to drop all constraints?

I know I can drop specific constraints.

DROP CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE 

However I want to clear all constraints as part of teardown after testing. Can't find anything in the docs, but something like:

DROP CONSTRAINT * 

Update: My testing setup.

Writing a tiny promise-based nodejs cypher client. I want to test defining unique indexes in application code.

like image 902
AJcodez Avatar asked Mar 12 '14 16:03

AJcodez


People also ask

How do I delete all constraints in Neo4j?

Note using APOC you can drop all indexes and constraints via CALL apoc. schema. assert({}, {}) . Nice - that's amazing and quick!

How delete all nodes and relationships in Neo4j give example?

There is a method to delete a node and all relationships related to that node. Use the DETACH DELETE statement: Example: MATCH (Kohli:player{name: "Virat Kohli"}) DETACH DELETE Kohli.

How do I remove a property from Neo4j?

Remove all properties REMOVE cannot be used to remove all existing properties from a node or relationship. Instead, using SET with = and an empty map as the right operand will clear all properties from the node or relationship.


1 Answers

Note using APOC you can drop all indexes and constraints via CALL apoc.schema.assert({}, {}).

like image 179
John Avatar answered Oct 12 '22 20:10

John