mix ash_postgres.gen.resources (ash_postgres v2.6.11)
View SourceGenerates 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 topublic.*. 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_migrationsis 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. Seemix ash.patch.extendfor more.yes,y- Answer yes (or skip) to all questions.default-actions- Add default actions for each resource. Defaults totrue.public- Mark all attributes and relationships aspublic? true. Defaults totrue.no-migrations- Do not generate snapshots & migrations for the resources. Defaults tofalse.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.public- Mark all attributes and relationships aspublic? true. Defaults totrue.
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.