Ecto: migration file empty of logic



I’m using Phoenix (first time) (changelog says version 1.3.3) and following the beta of the book Programming Phoenix 1.4.

Did what is showed on the page 55 of the book, then mix ecto.gen.migration create_users, but the migration file is just:

defmodule Rumbl.Repo.Migrations.CreateUsers do
  use Ecto.Migration

  def change do


Any idea what should I do to make this work?


I’m not sure what’s on page 55 of the book, but that is the intended behavior of mix ecto.gen.migration create_users.

When you run that command, you are expected to create your own migrations, something like:

defmodule Rumbl.Repo.Migrations.CreateUsers do
  use Ecto.Migration

  def change do
    create table("users") do
      add :name, :string


Maybe you missed a step where they wanted you to use phx.gen.*?

i.e. phx.gen.html, phx.gen.json, phx.gen.schema

These generators take more arguments and will generate something that looks like what I wrote above.


You should use phoenix in version 1.4 for that book… It’s as unreleased as the book though, you need to take some extra steps to use and install that version.

Please either use a version matching your learning resources or use resources matching your version.

I wouldn’t rely on unreleased versions for the purpose of learning though…


Since I wanted to buy a book, I bought the one that will be the near future.
I guess it will be better to install Phoenix 1.4 dev, then.
Let’s find out how to install it.
Thanks @NobbZ


How you install the in-dev phx_gen is described here:

(anchored link to a readme on github, will not work on mobile version of github site)


Didn’t see any of those steps in the book.
I’ll restart with the latest Phoenix version.
Thanks @voughtdq


I have the same book and came acrros the same problem, the thing is that if you read carefully in the book is stated “Key in these changes within your empty change function” which means that the file itself is the way it supposed to be you just need to update it to look like the one in the book.


Hi nikolis,

Yes, I found the solution some time afterwards.
Not being native in English also means, at least for me, to overlook some expressions and take a wrong meaning from what I’m not reading carefully enough.