Using Cypher to generate Cypher statements to recreate indexes and constraints

cypher
constraint
knowledge-base
index

(Dana Canzano) #1

The following can be used to extract index defintions and constraint defintions from an existing database and the resultant
output can be played back on another Neo4j database.

To extract Cypher CREATE INDEX statements run:

CALL db.indexes() YIELD description
RETURN 'CREATE ' + description

To extract Cypher CREATE CONSTRAINT statements run:

CALL db.constraints() YIELD description
RETURN 'CREATE ' + description