# `mix sigra.upgrade`
[🔗](https://github.com/sztheory/sigra/blob/v1.20.0/lib/mix/tasks/sigra.upgrade.ex#L1)

Upgrades a Sigra-installed app from an older schema version to the
current library version (Phase 18 D-08).

## Usage

    mix sigra.upgrade [--yes] [--dry-run] [--allow-dirty]
                      [--backfill-personal-orgs] [--from VERSION]

## Flags

  * `--yes` — skip interactive prompts. **Required for CI.**
  * `--dry-run` — print the plan without writing anything.
  * `--allow-dirty` — bypass the dirty-git-tree check.
  * `--backfill-personal-orgs` — generate the personal-org
    backfill data migration (Phase 18 D-02).
  * `--from VERSION` — override auto-detected source version
    (normally read from `config :sigra, :schema_version` in
    `config/config.exs`). Useful for partial rollbacks.

## Examples

    # Standard upgrade with interactive confirmation:
    mix sigra.upgrade

    # Non-interactive (CI) upgrade with backfill:
    mix sigra.upgrade --backfill-personal-orgs --yes

    # Preview without writing:
    mix sigra.upgrade --dry-run

## Telemetry

Backfill emits `[:sigra, :upgrade, :backfill, :batch]` events per
batch. See `Sigra.Upgrade.Backfill` moduledoc for measurement
keys.

## Behaviour

Delegates to `Sigra.Upgrade.run/1` after validating options via
`NimbleOptions`. All security-critical logic (git dirty check,
version detection, downgrade refusal, injection, template
walking) lives in the versioned library so fixes ship via
`mix deps.update`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
