Skip to content

馃殌 [Feature]: Support SurrealDB v3 in the surrealdb storage driver#2815

Description

@ReneWerner87

Description

The latest Docker tag of surrealdb/surrealdb moved to SurrealDB v3 (currently v3.1.4). Unlike v2, SurrealDB v3 no longer creates namespaces and databases implicitly on USE. As a result, all tests and benchmarks of the surrealdb module failed with:

The namespace 'testns' does not exist

As a quick fix, the test image was pinned to surrealdb/surrealdb:v2 (commit 1497c152). The storage driver itself currently does not work against a SurrealDB v3 server when namespace and database do not exist yet.

Proposed changes

  • Sign in first, then ensure namespace and database exist before selecting them:
    • run DEFINE NAMESPACE IF NOT EXISTS <ns> and DEFINE DATABASE IF NOT EXISTS <db> (requires sufficient privileges), then call Use
    • note: surrealdb.go:37 currently calls db.Use() before db.SignIn(), this order needs to be swapped
  • Bump github.com/surrealdb/surrealdb.go (currently v1.4.0, targets SurrealDB 2.x) once a v3-compatible release is available
  • Switch the test image back from the v2 pin to a v3 tag and verify tests and benchmarks pass

Additional context

First green run on main with the v2 pin: https://github.com/gofiber/storage/actions/runs/27302185817

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions