Search code examples
migrationelixirecto

Umbrella application error when trying to create a migration with ecto elixir


I'm trying to create a migration using the command mix ecto.gen.migration <migration_name> and I'm getting the error:

Cannot run task "ecto.gen.migration" from umbrella application

Why I'm getting this error?


Solution

  • For umbrella apps you need to explicitly run the migrations inside the application where the repo lives. This is because in umbrella applications, you can have multiple applications, all with multiple repos, so the generator would not know which application to run it for, so you have to run it within that application.

    cd apps/my_app_name && mix ecto.gen.migration create_users