Ecto.Migration.add_if_not_exists
You're seeing just the function
add_if_not_exists
, go back to Ecto.Migration module for more information.
Adds a column if it not exists yet when altering a table.
If the type
value is a %Reference{}
, it is used to add a constraint.
type
and opts
are exactly the same as in add/3
.
This command is not reversible as Ecto does not know about column existence before the creation attempt.
Examples
alter table("posts") do
add_if_not_exists :title, :string, default: ""
end