Migration Guide

APOC v.5 upgrade and migration

For information on how to migrate your Neo4j database, see the Neo4j Migration Guide.

Upgrade or patch APOC v.5

Review changes

Review the changelog on the releases to see what has been introduced or changed in the new version.

A list of deprecations, updates, and additions can also be found here.

Migrate databases from Neo4j v.4.4

Databases can only be migrated to Neo4j v.5 from Neo4j v.4.4.

As of Neo4j version 5, APOC has been split into two separate repositories:

  • APOC Core Library - officially supported by Neo4j.

  • APOC Extended - a community-managed repository not officially managed by Neo4j.

The APOC Full package (APOC Core + APOC Extended) is no longer available. To use non-supported APOC Extended procedures and functions, refer to the APOC Extended repository.

APOC Configuration

As of APOC v.5, the neo4j.conf no longer supports apoc.* configuration settings. All configuration settings should be put inside apoc.conf. They can also be set using environment variables.

If the config settings are in the neo4j.conf and server.config.strict_validation.enabled is set to true, the database will be prevented from starting up. Also, note that if this setting is disabled, any apoc.* settings remaining in neo4j.conf will not be read and therefore not set.

APOC Triggers

The migration of Neo4j from v.4.4 to v.5 requires the restoration of a backup. As APOC Triggers are stored on the system database, they are not included in the backup, and will therefore not be migrated over with the rest of your data.

It is, therefore, necessary to recreate all your triggers using the apoc.trigger.install procedure and adjusting apoc.trigger.stop as required.

For example, in a Neo4j v.4.4 database that already has existing APOC Triggers installed, the following query can be run (routed against the neo4j database):

CALL apoc.trigger.list();
Table 1. Results
name query selector params installed paused

"count-removals"

MATCH (c:NodesCounter) SET c.count = c.count + size([f IN $deletedNodes WHERE id(f)  0] SET time = $time)

{"phase":"after"}

{time: 1674218712858}

TRUE

FALSE

"count-relationships"

MATCH (c:RelationshipsCounter) SET c.count = c.count + size([f IN $createdRelationships WHERE id(f)  0])

{}

{}

TRUE

TRUE

The above triggers can be recreated on a Neo4j v.5 database (routed against a system LEADER database) by doing the following:

CALL apoc.trigger.install(
  'neo4j',
  'count-removals',
  "MATCH (c:NodesCounter) SET c.count = c.count + size([f IN $deletedNodes WHERE id(f) > 0] SET time = $time)",
  {phase: 'after'},
  {params: {time: 1674218712858}}
);

CALL apoc.trigger.install(
  'neo4j',
  'count-relationships',
  "MATCH (c:RelationshipsCounter) SET c.count = c.count + size([f IN $createdRelationships WHERE id(f) > 0])",
  {}
);

CALL apoc.trigger.stop('neo4j', 'count-relationships')

The APOC Triggers are now migrated to your new Neo4j v5 database.