It is stated that the default gen settings can be overridden with use of appropriate options,
Default options
This generator uses default options provided in the :generators configuration
of your application. These are the defaults:
config :your_app, :generators,
migration: true,
binary_id: false,
timestamp_type: :naive_datetime,
sample_binary_id: "11111111-1111-1111-1111-111111111111"
You can override those options per invocation by providing corresponding
switches, e.g. --no-binary-id to use normal ids despite the default
configuration or --migration to force generation of the migration.
however preventing the generation of a migration using the --no-migration key does not seem to work.
mix phx.gen.context Testex Testa testas --no-migration
* creating lib/schem_exp/testex/testa.ex
* creating priv/repo/migrations/20250210111130_create_testas.exs
* creating lib/schem_exp/testex.ex
* injecting lib/schem_exp/testex.ex
* creating test/schem_exp/testex_test.exs
* injecting test/schem_exp/testex_test.exs
* creating test/support/fixtures/testex_fixtures.ex
* injecting test/support/fixtures/testex_fixtures.ex
Remember to update your repository by running migrations:
$ mix ecto.migrate
Then I discard the generated files via version control and run again with phx.gen.context, get the same result. Do the discard again and this time run with phx.gen.schema:
mix phx.gen.schema Testa testas --no-migration
* creating lib/schem_exp/testa.ex
No migration generated.
Is it the case that migration generation with contexts can only be prevented by amending the defaults ? (doing does indeed actually prevent migration generation)