Ecto.Migration.modify

You're seeing just the function modify, go back to Ecto.Migration module for more information.
Link to this function

modify(column, type, opts \\ [])

View Source

Modifies the type of a column when altering a table.

This command is not reversible unless the :from option is provided. If the :from value is a %Reference{}, the adapter will try to drop the corresponding foreign key constraints before modifying the type. Note :from cannot be used to modify primary keys, as those are generally trickier to make reversible.

See add/3 for more information on supported types.

Examples

alter table("posts") do
  modify :title, :text
end

Options

  • :null - determines whether the column accepts null values.
  • :default - changes the default value of the column.
  • :from - specifies the current type of the column.
  • :size - specifies the size of the type (for example, the number of characters). The default is no size.
  • :precision - the precision for a numeric type. Required when :scale is specified.
  • :scale - the scale of a numeric type. Defaults to 0.