Programming Phoenix (Pragprog)

Hello everyone,

I don’t know if this is the right place to question about some code of the book so if Im at the wrong place just let me know. here I go

At chapter 4 (Esto), user struct is modified into this

“defmodule​ Rumbl.Accounts.User ​do​
​ ​use​ Ecto.Schema
​ ​import​ Ecto.Changeset
​
​ schema ​"​​users"​ ​do​
​ field ​:name​, ​:string​
​ field ​:username​, ​:string​
​
​ timestamps()
​ ​end​
​ ​end​”

then a code is generated with the sentence ​​-> mix​​ ​​ecto.gen.migration​​ ​​create_users​

The file generated in my case was almost empty
defmodule Rumbl.Repo.Migrations.CreateUsers do
use Ecto.Migration

def change do

end
end

My question is, was the code well generated? and is my duty edit it and make it into this(just as appears in the book)

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

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

  timestamps()
end

create unique_index(:users, [:username])

end
end

I still don’t get if the sentence → mix​​ ​​ecto.gen.migration​​ ​​create_users​ really generate the migration file with the add sentences and timestamp or if it just creates the skeleton just like it did in my case.

Thanks in advance to anyone and I hope you can give me a hand. I’m really excited reading this book.

regards