# `mix ecto.doctor`
[🔗](https://github.com/Daniel-Brai/ecto-doctor/blob/v0.0.1/lib/mix/tasks/ecto.doctor.ex#L1)

Checks your Ecto schemas and changesets against the live database.

    mix ecto.doctor

It exits with status 1 when a finding is at or above `--fail-on` so it can run in CI as it is.

## Flags

  * `--repo` or `-r` picks the repo. Repeat it for several. Defaults to the app's `ecto_repos`.
  * `--only` runs only these checks, as a comma separated list.
  * `--except` skips these checks.
  * `--all` reports info level findings too.
  * `--format` is `text`, `json`, `sarif` or `github`. Defaults to `text`.
  * `--fail-on` is `error`, `warning` or `info`. Defaults to `error`.
  * `--fix` writes migrations for every fix a migration can make. On PostgreSQL indexes are built concurrently and constraints are validated in a later migration.
  * `--apply` runs only those migrations after you confirm.
  * `--no-baseline` reports findings the baseline file would leave out.
  * `--config` reads options from this file. Defaults to `.ecto_doctor.exs`.

`mix ecto.doctor.explain` describes every check.

---

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