Put a metadata backup in place of the local database (the current one is kept aside)

Usage: barca state restore [OPTIONS]

Options:
      --from <N|NAME>  Which backup: its index in `barca state backups` (1 = newest) or its name; default the newest
      --json           Emit JSON on stdout (the default when stdout is not a terminal)
      --pretty         Emit human-readable output (the default when stdout is a terminal)
      --env <ENV>      Environment name (separates cache/state per environment)
  -h, --help           Print help

Examples:
  barca state restore                  # the newest backup
  barca state restore --from 2         # the second newest
  barca state restore --from 2026-10-14T18-02-11.482Z-3f9a1c2e  # by name, .db optional
  barca state restore --json           # {restored, from, source, pre_restore, rows, run_id}

The copy is checked first (a whole SQLite file, integrity, barca's tables, a format this barca
can use): the local copy when there is one, else the store's. A copy that fails is a usage error
naming the next newest, and nothing changes. Then the current database moves to
metadata.db.pre-restore (replacing an older one) and the copy takes its place; one line on
stderr says what was restored and from where. Stop barca get/run in this project first.
Exit 2: no backup, unknown --from, a copy that is not valid. Exit 3: barca serve is running.
More: barca docs remote
