Skip to main content

backup:create

Creates a new backup of the current database state - all nodes, all relations, and (unless disabled) any stored files - and writes it to var/backup/<name> on local storage.

The name argument is optional and defaults to the current timestamp (YmdHis). The name can not be empty, ., or .., and the command fails if a backup with the same name already exists; use backup:load to restore, or backup:fetch to import one from a remote source.

Options:

  • -p, --pretty - pretty-prints the exported JSON files. Off by default, since it makes backups noticeably larger.
  • --no-files - skips exporting files, only backing up nodes and relations.

A summary.json is written alongside the backup with the node/relation/schema/file counts, hostname and API version. backup:list reads it to populate its table. The node labels and relation types of the database are not part of it, they are known from the schema files, see Schemas. The format of the file is described by the JSON Schema backup-summary.schema.json, which the tests of the command are checked against.

The command counts nodes and relations up front and pages through them while exporting, so it can take a while on large graphs. It does not lock the database, so changes made while a backup is running are not guaranteed to be captured consistently.

Help

php bin/console backup:create --help
Description:
  Creates a new backup.

Usage:
  backup:create [options] [--] [<name>]

Arguments:
  name                          Name of the backup, defaults to the current timestamp. [default: "20261204013745"]

Options:
  -p, --pretty|--no-pretty      Activates pretty print of JSON.
      --no-files|--no-no-files  Disable file export.
  -h, --help                    Display help for the given command. When no command is given display help for the list command
      --silent                  Do not output any message
  -q, --quiet                   Only errors are displayed. All other output is suppressed
  -V, --version                 Display this application version
      --ansi|--no-ansi          Force (or disable --no-ansi) ANSI output
  -n, --no-interaction          Do not ask any interactive question
  -e, --env=ENV                 The Environment name. [default: "prod"]
      --no-debug                Switch off debug mode.
      --profile                 Enables profiling (requires debug).
  -v|vv|vvv, --verbose          Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Example

php bin/console backup:create test
    ▄
  ▄▀ ▀▄  Ember Nexus API
   ▀█▀   v0.3.0, production mode

  Backup Create

Creating backup test in folder ./var/backup

┌ Step 1 of 3: Backing up Nodes ────────────────────────────────────────────────
│ Found 0 nodes.
└ Successfully backed up 0 nodes.

┌ Step 2 of 3: Backing up Relations ────────────────────────────────────────────
│ Found 0 relations.
└ Successfully backed up 0 relations.

┌ Step 3 of 3: Backing up Files ────────────────────────────────────────────────
│ Found 0 files.
└ File backup skipped.

▶ Backup finished successfully.