API version: 0.3.0

---

# `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](/reference/schemas.md#backups). The format of the file is described by
the [JSON Schema `backup-summary.schema.json`](/schemas/backup-summary.schema.json), which the tests of the command are
checked against.

> **⚠ Note**
>
> 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

```bash
php bin/console backup:create --help
```

```text
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

```bash
php bin/console backup:create test
```

```text
    ▄
  ▄▀ ▀▄  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.
```

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)

Previous: [backup:convert](/command/backup-convert.md)

Next: [backup:fetch](/command/backup-fetch.md)
