Skip to content

Migrate neo4j-go-driver from v4 to v5 #29

Description

@peter7775

Problem Statement

The project uses github.com/neo4j/neo4j-go-driver/v4 v4.4.8 (see go.mod:15). Driver v4 doesn't support the native vector index or newer Bolt protocol features in Neo4j 5.x. v5's API replaces neo4j.NewDriver, Session, session.Run with context-aware equivalents (neo4j.NewDriverWithContext, SessionWithContext, ExecuteRead/ExecuteWrite).

Proposed Solution

  • Bump github.com/neo4j/neo4j-go-driver/v4 to v5 in go.mod.
  • Update all call sites in:
    • internal/domain/repositories/neo4j/client.go
    • internal/infrastructure/persistence/neo4j/repository.go
    • internal/application/bootstrap/bootstrap.go
    • internal/application/services/migration/migration.go
    • internal/tests/integration/transform_service_test.go
  • Move from Session/Run to SessionWithContext/ExecuteRead/ExecuteWrite, propagating context.Context through the repository/service layers (DDD ports).
  • Verify transaction retry logic and error handling match the new API.

Alternative Solutions

Stay on v4 and implement vector search outside Neo4j — rejected, see the "Upgrade Neo4j server from 4.4 to 5.13+" issue.

Use Case

Required step to use Neo4j 5.x's native vector index, and to stay on a driver version that still receives new features.

Priority Level

Important

Implementation Ideas

  • Migrate layer by layer: client.go first (lowest level), then repository.go, then bootstrap.go and migration.go.
  • Add a context.Context parameter to existing ports in internal/application/ports/ if not already present.
  • Run internal/tests/integration/transform_service_test.go against the Neo4j 5.13+ instance from the server upgrade issue.

Additional Context

Depends on: "Upgrade Neo4j server from 4.4 to 5.13+" (needs a Neo4j 5.x test environment available).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend/server related workbreaking-changeChanges that may break backward compatibilitydatabaseDatabase related changes - MySQL, Neo4j, queries

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions