# `Igniter.Libs.Ecto`
[🔗](https://github.com/ash-project/igniter/blob/v0.8.2/lib/igniter/libs/ecto.ex#L5)

Codemods & utilities for working with Ecto

# `gen_migration`

```elixir
@spec gen_migration(
  Igniter.t(),
  repo :: module(),
  name :: String.t(),
  opts :: Keyword.t()
) ::
  Igniter.t()
```

Generates a new migration file for the given repo.

## Options

- `:body` - the body of the migration
- `:timestamp` - the timestamp to use for the migration.
   Primarily useful for testing so you know what the filename will be.
- `:on_exists` - what to do if the migration *module* already exists. Options are:
  - `:increment` - Calls this function again, but with an increasing number at the end, until it finds a free name. (default)
  - `:skip` - do nothing
  - `:overwrite` - overwrites the file
  - `{:error, error}` - adds an issue to the igniter that prevents writing and displays to the user
  - `{:warning, warning}` - adds a warning to the igniter that allows writing but displays to the user

# `list_repos`

```elixir
@spec list_repos(Igniter.t()) :: {Igniter.t(), [module()]}
```

Lists all the ecto repos in the project

# `select_repo`

```elixir
@spec select_repo(Igniter.t(), Keyword.t()) :: {Igniter.t(), nil | module()}
```

Selects a repo module from the list of available repos.

## Options

* `:label` - The label to display to the user when selecting the repo

---

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