API version: 0.3.0

---

# `backup:load`

Loads a previously created local backup into the database, restoring its nodes, relations, and
files.

The `name` argument is required and must match an existing backup folder containing a
`summary.json` (as created by `backup:create` or `backup:fetch`). Nodes and relations are imported
in batches, files are re-uploaded to object storage, and a final pass re-dispatches update events
for every imported node and relation so that dependent systems (such as the search index) pick up
the restored data; the Redis cache is flushed at the end of the process.

Options:

- `--skip-verify` - skips verifying file contents against their stored `file.hash` values. Without it, files that
  fail verification are skipped and reported as errors on the console and in the logs; the element keeps
  `hasFile=true` and the command's exit code stays `0`.
- `--skip-mphf-build` - does not build the [element type index](/command/mphf-build.md) after loading; run `mphf:build`
  afterwards instead.

The node labels and relation types are read from the schema files of the backup (older backups: from the
`graphStructure` of the `summary.json`), and the id indices (see [`index:ensure`](/command/index-ensure.md)) for all of
them are created before the first element is loaded, so that nodes and relations are never matched without them. Backups
from before the summary contained the graph structure are loaded the old way: the indices are created after the nodes
and after the relations. When everything is loaded, the cached graph structure is dropped and read again from the loaded
database, and the element type index is built at the end. Right after the schemas are loaded, the additive steps of
Elasticsearch and MongoDB (index, mapping, collection and validator,
[not indices](/reference/schemas/migrations.md#additive-steps-are-applied-right-away)) are applied, so the loaded elements
never create an index with a dynamic mapping, and the cache of the schemas is invalidated. The command takes the
maintenance locks, so these tasks stay quiet in the meantime.

Backups are loaded as they are, their content is never rewritten. Which backups can be loaded is decided by the
`version` property of the `summary.json`: backups created before 0.2.0 use an older format and are refused, with the
suggestion to convert them using [`backup:convert`](/command/backup-convert.md) first. Backups of development builds
(`dev`) and backups without a version are loaded. Ids with timestamps in the future are imported as they are, and a
warning is logged.

> **⚠ Note**
>
> The target database must be empty - the command checks for existing nodes or relations up
> front and refuses to run otherwise. Loading into a non-empty database is not supported.

## Help

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

```text
Description:
  Loads a local backup into the empty database.

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

Arguments:
  name                   Name of the backup

Options:
      --skip-mphf-build  Do not build the element type index after loading; run mphf:build afterwards instead
      --skip-verify      Skip verifying file contents against their stored 'file.hash' values
  -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:load reference-dataset
```

```text
    ▄
  ▄▀ ▀▄  Ember Nexus API
   ▀█▀   v0.3.0, production mode

  Backup Load

  Creating node and relation id indices...
  Loading schemas...
  Applied 12 additive schema steps.
  Loaded 6 schemas.
┌ Step 1 of 4: Loading Nodes ───────────────────────────────────────────────────
└ Loaded 1342 nodes.

┌ Step 2 of 4: Loading Relations ───────────────────────────────────────────────
└ Loaded 3065 relations.

┌ Step 3 of 4: Loading Files ───────────────────────────────────────────────────
└ Loaded 69 files.

┌ Step 4 of 4: After Backup Tasks ──────────────────────────────────────────────
└ Finished all after backup tasks.

  Syncing schemas...
  Created 3 schemas, repaired 0 built-in schemas.
  Planned 0 migrations again, cancelled 0 migrations with nothing left to do.
┌ Building element type index ──────────────────────────────────────────────────
│   Switching the Redis overlay, new elements are tracked there from now on.
│   Making sure id indices exist.
│   Exporting element ids.
│   Exported 4451 ids.
│   Building the index from 4451 ids.
│   Uploading to the system bucket.
│   Element id filter is complete and in use.
└ Built 20261205-231035.mphf with 4451 ids.

▶ Backup successfully loaded.
```

---

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

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

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

Next: [cache:clear:etag](/command/cache-clear-etag.md)
