Hi,
This might be a pretty simple question, but could not find any exmples anywhere. I want to store an array of strings in postgresql. How do we go about defining this in the ecto schema? It should be something like [“One”, “Two”, …]
This is what I tried so far
product_certs: [String.t()] embeds_many :product_certs, String, on_replace: :delete
You can define a field in your Ecto.Schema be of the {:array, :string} type.
Ecto.Schema
{:array, :string}
Reference: Ecto.Schema — Ecto v3.9.2
Embed is meant for schemas within schemas.
How to iterate over this in a form?
That was not your original question. Ask another one if you have solved the particular problem you stated in your original post, please.