Defect: Null: False used to define NOT NULL Column is throwing compilation error in 3.8 ECTO Version

In Ecto 3.5.x version we use null: false in the Ecto schema to create not null column in postgress database.

Now if we use the same in 3.8 the code is not even compiling.

Error stack is something like

** (ArgumentError) invalid option :null for field/3
(ecto 3.8.2) lib/ecto/schema.ex:2214: Ecto.Schema.check_options!/3
(ecto 3.8.2) lib/ecto/schema.ex:1911: Ecto.Schema.field/4
lib/tradeserf/model/oneoff_acct_group.ex:9: (module)
(stdlib 3.17) erl_eval.erl:685: :erl_eval.do_apply/6
(elixir 1.12.3) lib/kernel/parallel_compiler.ex:319: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

Definition is :

schema “oneoff_acct_group” do
field(:acct_group_id, :string, primary_key: true)
field(:acct_group_nm, :string, null: false)
field(:entity_id, :string)
field(:owner, :string)



This is not a bug, as fields never supported a null option to begin with. It’s only a supported option for add in migrations. The thing, which changed is that ecto now actually validates options instead of silently ignoring them, so you can fix them.