简体   繁体   中英

Ecto migration alter table ** (FunctionClauseError) no function clause matches

While running mix ecto.migrate I was bumping into this issue

10:53:59.187 [info] == Running 
20201005163129 Universe.Repo.Migrations.UpdatePlanetsTable.change/0 forward
** (FunctionClauseError) no function clause matches

With the following migration

  alter table(:planet) do
    add :solar_system, :string
    modify :name, null: false
  end

What did I do wrong?

My mistake was not giving modify the second argument for the type of the field and instead only the options.

  alter table(:planet) do
    add :solar_system, :string
    modify :name, :string, null: false
  end

Always look up the correct prototype when

** (FunctionClauseError) no function clause matches

Also would be nice to have the name of the function/macro in the error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM