尝试使用 ecto elixir 创建迁移时出现 Umbrella 应用程序错误

Hat*_*umi 5 migration elixir ecto

我正在尝试使用该命令创建迁移mix ecto.gen.migration <migration_name>,但出现错误:

Cannot run task "ecto.gen.migration" from umbrella application
Run Code Online (Sandbox Code Playgroud)

为什么我收到这个错误?

Har*_*cas 5

对于伞形应用程序,您需要在存储库所在的应用程序内显式运行迁移。这是因为在伞形应用程序中,您可以拥有多个应用程序,所有应用程序都具有多个存储库,因此生成器不知道要为哪个应用程序运行它,因此您必须在该应用程序中运行它。

cd apps/my_app_name && mix ecto.gen.migration create_users
Run Code Online (Sandbox Code Playgroud)