# `mix ash_postgres.gen.resources`
[🔗](https://github.com/ash-project/ash_postgres/blob/v2.8.0/lib/mix/tasks/ash_postgres.gen.resources.ex#L6)

Generates resources based on a database schema

## Example

`mix ash_postgres.gen.resources MyApp.MyDomain`

## Domain

The domain will be generated if it does not exist. If you aren't sure,
we suggest using something like `MyApp.App`.

## Options

- `repo`, `r` - The repo or repos to generate resources for, comma separated. Can be specified multiple times. Defaults to all repos.
- `tables`, `t` - Defaults to `public.*`. The tables to generate resources for, comma separated. Can be specified multiple times. See the section on tables for more.
- `skip-tables`, `s` - The tables to skip generating resources for, comma separated. Can be specified multiple times. See the section on tables for more. `schema_migrations` is always skipped.
- `snapshots-only` - Only generate snapshots for the generated resources, and not migrations.
- `extend`, `e` - Extension or extensions to apply to the generated resources. See `mix ash.patch.extend` for more.
- `yes`, `y` - Answer yes (or skip) to all questions.
- `default-actions` - Add default actions for each resource. Defaults to `true`.
- `public` - Mark all attributes and relationships as `public? true`. Defaults to `true`.
- `no-migrations` - Do not generate snapshots & migrations for the resources. Defaults to `false`.
- `skip-unknown` - Skip any attributes with types that we don't have a corresponding Elixir type for, and relationships that we can't assume the name of.
- `fragments` - Generate attributes and relationships in a separate fragment file. This allows the fragment to be regenerated without affecting user customizations in the main resource file. Defaults to `false`.

## Tables

When specifying tables to include with `--tables`, you can specify the table name, or the schema and table name separated by a period.
For example, `users` will generate resources for the `users` table in the `public` schema, but `accounts.users` will generate resources for the `users` table in the `accounts` schema.

To include all tables in a given schema, add a period only with no table name, i.e `schema.`, i.e `accounts.`.

When skipping tables with `--skip-tables`, the same rules apply, except that the `schema.` format is not supported.

---

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