Apoc optionally allows you to run a cypher command after database initialization is finished. This can e.g. be used to ensure indexes/constraints are created up front.
To use this feature use a config option:
apoc.initializer.cypher=CALL apoc.cypher.runSchemaFile("file:///indexes.cypher")
For running multiple statements you can also add suffixes to the config options, like cypher.1
, cypher.2
.
The statements will then be executed in sort-order.