Programming Phoenix (Pragprog)

I’m certainly no expert on Phoenix, but I did go through that chapter recently.

My understanding is that mix​​ ​​ecto.gen.migration​​ ​​create_users will only generate the skeleton of the migration. You would then fill out the schema section and run mix ecto.migrate to apply the changes to the database.

I believe the authors’ intentions were to show how to not rely exclusively on generators, which are later presented in Chapter 6. For instance, one command seen later on mix phx.gen.html Multimedia Video videos user_id:references:users url:string title:string description: test generates several files, including a more fleshed out migration based on the inputs provided for the command.

Hopefully I didn’t butcher any explanation too badly, but that should be the gist… Hope that helps!

1 Like