# `mix threadline.retention.purge`
[🔗](https://github.com/szTheory/threadline/blob/v0.9.0/lib/mix/tasks/threadline.retention.purge.ex#L1)

Delegates to `Threadline.Retention.purge/1` after loading application config and
starting the configured Ecto repo (same resolution pattern as `mix threadline.verify_coverage`).

## Configuration

Purge is a no-op (Mix **raises**) unless **`config :threadline, :retention, enabled: true`**
and the rest of the map passes `Threadline.Retention.Policy.validate_config!/1`.

## Flags

- **`--batch-size`** — rows per delete pass (default `500` in `purge/1`).
- **`--max-batches`** — safety cap on outer iterations.
- **`--dry-run`** — counts eligible `audit_changes` / empty `audit_transactions` only; **no deletes**.
- **`--execute`** — **required when `MIX_ENV=prod`**, in addition to `enabled: true`, so production
  crons cannot delete data from a mistyped command alone.

## Examples

    mix threadline.retention.purge --dry-run
    mix threadline.retention.purge --batch-size 200 --max-batches 50

Production (after explicit config review):

    MIX_ENV=prod mix threadline.retention.purge --execute --batch-size 500

---

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