# `mix localize.unit.gen.migration`
[🔗](https://github.com/elixir-localize/localize_sql/blob/v1.0.1/lib/mix/tasks/localize.unit.gen.migration.ex#L2)

Generates an Ecto migration that installs the unit composite types and
their aggregate functions into a PostgreSQL database.

The migration creates the `cldr_unit` and `cldr_unit_with_usage`
composite types and their `sum`, `min`, `max` and `avg` aggregates, so
that `Localize.Unit.Ecto.Composite.Type` columns can be summed and
averaged in the database. See `Localize.Unit.DDL`.

    mix localize.unit.gen.migration -r MyApp.Repo

### Options

* `-r`, `--repo` is the repository to generate the migration for, as
  `Mix.Ecto` accepts it. The default is the application's configured
  repository.

---

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