# `mix ancestry_ex.gen.schema`
[🔗](https://github.com/rocket4ce/ancestry_ex/blob/v0.1.0/lib/mix/tasks/ancestry_ex.gen.schema.ex#L1)

Generates an Ecto schema that uses `AncestryEx`, and a migration creating
its table.

    $ mix ancestry_ex.gen.schema Catalog.Category categories name:string position:integer

The first argument is the schema module (relative to the application
module), followed by the plural name (also used as table name) and the
attributes as `name:type`.

Supported types: `string`, `text`, `integer`, `float`, `decimal`, `boolean`,
`date`, `time`, `naive_datetime`, `utc_datetime`, `uuid`, `binary`, `map`
and `array:<type>`. The type defaults to `string`.

## Options

  * `--orphan-strategy` - `destroy` (default), `rootify`, `adopt`,
    `restrict` or `none`.
  * `--cache-depth` / `--virtual-depth` - cache the depth in a column or in
    a PostgreSQL generated column.
  * `--counter-cache` - keep the number of children in `children_count`.
  * `--touch` - touch ancestors when a node changes.
  * `--format` - `materialized_path2` (default) or `materialized_path`.
  * `--column` - name of the ancestry column, `ancestry` by default.
  * `--table` - the table name, defaults to the plural name.
  * `--binary-id` - use `binary_id` (UUID) primary keys.
  * `--no-migration` - do not generate the migration.
  * `--repo` and `--migrations-path` - see `mix ancestry_ex.gen.migration`.

---

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