In fact, :bars
is defined:
> %Foo{}
%Foo{
__meta__: #Ecto.Schema.Metadata<:built, "foo">,
bars: [],
id: nil,
name: nil
}
So I don’t get why %Foo{} |> Shipfixcore.Repo.insert
produces a:
** (Postgrex.Error) ERROR 23502 (not_null_violation) null value in column "bars" violates not-null constraint
table: foo
column: bars
But I guess it has nothing to do with embeds_many
.
Edit:
I opened an other thread to get help for the underlying issue: How to persist an empty list in a `jsonb` column?
Maybe this one should be closed?