[Proposal] Allow --warnings-as-errors option when migrating or rolling back

22 views
Skip to first unread message

Gonçalo Tomás

unread,
Jun 6, 2025, 8:31:21 AMJun 6
to elixir-ecto
Hi all,

In CI setups it's quite common to see the `--warnings-as-errors` applied when compiling and even when running tests (since 1.12). I'm proposing the addition of this option also to Ecto.Migrator, so that warnings in migrations can be picked up and prevent the execution of migrations.

Currently, to set this up I believe involves either writing a custom Credo check or write an Elixir module in `/priv/repo/migrations` and have it call Code.compile_module or similar while capturing the output that gets sent to stderr. This last option also involves changing elixirc_paths and/or using a new custom MIX_ENV to do it. Both alternatives I can see add complexity to the project and are not easily accomplished by people new to the language given the lack of documentation around this use case.

I believe it makes sense to have a mechanism of scanning migrations for warnings even if the --warnings-as-errors option is not the best way to have it.

So does it make sense to have this option added? I'm willing to do the work required to get this merged, with some guidance of course, as long as the Ecto team sees value in it.

Thanks,
Gonçalo Tomás

Yevhenii Kurtov

unread,
Jun 6, 2025, 9:10:50 AMJun 6
to elixi...@googlegroups.com, elixir-ecto
That’s a great idea!

/Yevhenii 

On 6 Jun 2025, at 13:31, Gonçalo Tomás <goncal...@gmail.com> wrote:

Hi all,
--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-ecto/331b839b-56a9-4fe8-9219-471ba867456en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages