DEV Community

Sushant Bajracharya
Sushant Bajracharya

Posted on

1 2

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay