API version: 0.3.0

---

# `migration:run`

Runs the queued migrations, oldest first, see [`PATCH /migration/<uuid>`](/api/patch-migration.md). Queued migrations
are normally run right away by [`migration:listen`](/command/migration-listen.md); this command is the sweep for
everything which the listener did not get, e.g. because RabbitMQ was not reachable when the migration was queued. The steps of a
migration run one after another and their results are recorded on the migration; a failing step stops the migration with
the status `failed`. Migrations which are `running` without anybody working on them (e.g. after a crash) are marked as
failed, so that they can be queued again.

With the id of a migration as argument, this migration is run right now, even if it was not queued. The exit code is `1`
if it failed.

> **ℹ Info**
>
> Every API instance runs this command every 15 minutes (see
> [Background tasks](/reference/configuration.md#background-tasks)). It is skipped (successfully) while a backup is
> being loaded or the database is being reset.

## Help

```bash
php bin/console migration:run --help
```

```text
Description:
  Runs all queued migrations, or the given one regardless of whether it was queued.

Usage:
  migration:run [<id>]

Arguments:
  id                    Id of a migration which is run now, even if it was not queued.

Options:
  -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 migration:run
```

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

  Migration run

  0 succeeded, 0 failed, 0 interrupted.
▶ Done.
```

---

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

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

Previous: [migration:listen](/command/migration-listen.md)

Next: [schema:sync](/command/schema-sync.md)
