DEV Community

Sushant Bajracharya
Sushant Bajracharya

Posted on

TIL: Hidden switch of ecto_sql migration

There is a hidden switch --change for mix ecto.gen.migration.

mix ecto.gen.migration --change "create table(:user)"

The above code simply substitutes the value inside the def change function.

# excerpt from ecto_sql

  embed_template :migration, """
  defmodule <%= inspect @mod %> do
    use <%= inspect migration_module() %>

    def change do
  <%= @change %>
    end
  end
  """

Top comments (0)