• Start
Sign In

SurrealDB CLI

/

CLI commands

fix

A command to convert SurrealDB version 1.x data into a usable format for versions 2.0 and above.

Convert data written by SurrealDB 1.x into the storage format used by 2.0 and above.

Note

Before you start — make sure you’ve installed SurrealDB.

Usage
surreal fix [OPTIONS] [PATH]

Arguments

NameDefaultEnvironment variableDescription
[PATH]
memorySURREAL_PATHPath to the existing data to convert to the 2.x storage format, for example surrealkv://mydatabase.db.

Options

NameDefaultEnvironment variableDescription
--log, -l<LOG>
infoSURREAL_LOGThe logging level for the command-line tool. Possible values: none, full, error, warn, info, debug, trace.

To perform a fix from SurrealDB 1.x to 2.x storage, run the surreal fix command in a terminal with the path to the stored data.

surreal fix surrealkv://mydatabase.db

surreal fix rocksdb:somedatabase
Important

Most of the flags above have a corresponding environment variable.
For example, the --log flag can be configured with the SURREAL_LOG environment variable instead.

When using the surreal fix command, you can also use environment variables to set the values for the command-line flags.

For more on the environment variables available for CLI commands or SurrealDB instances in general, see the environment variables page.

To see the help information and usage instructions, in a terminal run the surreal fix --help command without any further arguments. This command gives general information on the arguments, inputs, and additional options for the fix command.

surreal fix --help

The output of the above command:

Fix database storage issues

Usage: surreal fix [OPTIONS] [PATH]

Arguments:
  [PATH]  Database path used for storing data [env: SURREAL_PATH=] [default: memory]

Options:
  -h, --help  Print help

Logging:
  -l, --log <LOG>                              The logging level for the command-line tool [env: SURREAL_LOG=] [default: info] [possible values: none, full, error, warn, info, debug, trace]
      --log-format <LOG_FORMAT>                The format for terminal log output [env: SURREAL_LOG_FORMAT=] [default: text] [possible values: text, json]
      --log-socket <LOG_SOCKET>                Send logs to the specified host:port [env: SURREAL_LOG_SOCKET=]
      --log-file-level <LOG_FILE_LEVEL>        Override the logging level for file output [env: SURREAL_LOG_FILE_LEVEL=] [possible values: none, full, error, warn, info, debug, trace]
      --log-otel-level <LOG_OTEL_LEVEL>        Override the logging level for OpenTelemetry output [env: SURREAL_LOG_OTEL_LEVEL=] [possible values: none, full, error, warn, info, debug, trace]
      --log-socket-level <LOG_SOCKET_LEVEL>    Override the logging level for unix socket output [env: SURREAL_LOG_SOCKET_LEVEL=] [possible values: none, full, error, warn, info, debug, trace]
      --log-socket-format <LOG_SOCKET_FORMAT>  The format for socket output [env: SURREAL_LOG_SOCKET_FORMAT=] [default: text] [possible values: text, json]
      --log-file-enabled                       Whether to enable log file output [env: SURREAL_LOG_FILE_ENABLED=]
      --log-file-path <LOG_FILE_PATH>          The directory where log files will be stored [env: SURREAL_LOG_FILE_PATH=] [default: logs]
      --log-file-name <LOG_FILE_NAME>          The name of the log file [env: SURREAL_LOG_FILE_NAME=] [default: surrealdb.log]
      --log-file-format <LOG_FILE_FORMAT>      The format for log file output [env: SURREAL_LOG_FILE_FORMAT=] [default: text] [possible values: text, json]
      --log-file-rotation <LOG_FILE_ROTATION>  The log file rotation interval [env: SURREAL_LOG_FILE_ROTATION=] [default: daily] [possible values: daily, hourly, never]

Was this page helpful?