View Source mix ash_postgres.gen.resources (ash_postgres v2.4.12)

Generates or updates resources based on a database schema

Example

mix ash_postgres.gen.resource 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.
  • snapshots-only - Only generate snapshots for the generated resources, and not migraitons.
  • 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.

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.