I would like to remove a field from an existing Ecto model:
field :age, :integer
After reading the docs I'm not sure what's the best/simple way of doing it (remove(column))?...Can you exemplify? I've tried:
def change do
create table(:users) do
remove :age
end
end
and it's not working.
You want to use alter/2 table instead of create table.
def change do
alter table(:users) do
remove :age
end
end
create/2
will raise if the table already exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With