I’m trying to add a column with a two dimensional array type to database.
Here’s my migration.
def change do
alter table(:decisions) do
add :sequence, {:array, {:array, :string}}
end
end
with this, i don’t get error running migration.
Here’s my schema
schema "decisions" do
...
field :sequence, {:array, {:array, :string}}
timestamps()
end
But when i try to save this value [["C83", "N51", "G3"], ["K22", "B17"], ["W46", "N14"]] to field :sequence, I got this error
(ArgumentError) nested lists must have lists with matching lengths
(postgrex) lib/postgrex/extensions/array.ex:63: anonymous fn/6 in Postgrex.Extensions.Array.encode/4
How do I put matching lists with matching lengths to :sequence column? Any help is appreciated.