You’re able to add default args for the generators in your config file:
config :your_app, :generators,
context: false,
schema: false,
migration: false
See: https://github.com/phoenixframework/phoenix/blob/v1.3.0/lib/mix/tasks/phx.gen.html.ex#L79
I’m not 100% that the options I used in my example are correct, I’m extrapolating from the docs. It shows the option as migration: false
and the corresponding flag --no-migration
, so maybe schema and context are the same.
More generally, something to consider is making your own generators that are tailored to your specification. I think it is just a matter of cp deps/phoenix/lib/mix/tasks/phx.gen.html.ex lib/your_app/mix/tasks/your_app.gen.html.ex
and then making the adjustments. Though keep in mind that the existing generators may rely on private apis that could change, as per this comment by Jose: Customizing `mix phoenix.gen.*` tasks