Elixir 使用EXTO 2.0.0-rc.0并执行EXTO.migrate时出现奇怪错误
今天,像往常一样,我尝试在我的Phoenix应用程序中制作mix-exto.migrate,意外地发现以下错误:Elixir 使用EXTO 2.0.0-rc.0并执行EXTO.migrate时出现奇怪错误,elixir,phoenix-framework,ecto,Elixir,Phoenix Framework,Ecto,今天,像往常一样,我尝试在我的Phoenix应用程序中制作mix-exto.migrate,意外地发现以下错误: warning: could not find repositories for application :adah. You can avoid this warning by passing the -r flag or by setting the repositories managed by this application in your config files:
warning: could not find repositories for application :adah.
You can avoid this warning by passing the -r flag or by setting the
repositories managed by this application in your config files:
config :adah, ecto_repos: [...]
The configuration may be an empty list if it does not define any repo.
** (Protocol.UndefinedError) protocol Enumerable not implemented for :ok
(elixir) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir) lib/enum.ex:116: Enumerable.reduce/3
(elixir) lib/enum.ex:1486: Enum.reduce/3
(elixir) lib/enum.ex:609: Enum.each/2
(mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
我的部门是:
phoenix_ecto: 3.0.0-rc.0
ecto: 2.0.0-rc.0
...
我的配置文件包含以下行:
dev.ex:
# Configure your database
config :adah, Adah.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "adah_dev",
hostname: "localhost",
pool_size: 10
test.ex:
# Configure your database
config :adah, Adah.Repo,
adapter: Ecto.Adapters.Postgres,
username: System.get_env("POSTGRES_USER") || "postgres",
password: System.get_env("POSTGRES_PASSWORD") || "postgres",
database: System.get_env("POSTGRES_DB") || "adah_test",
hostname: System.get_env("POSTGRES_HOST") || "localhost",
pool: Ecto.Adapters.SQL.Sandbox
在dev环境中运行测试或服务页面时,我并没有此类错误,只有在运行mixecto.migrate时
所以。。。我应该向我的配置文件中添加什么或传入-r标志
更新:我相信有一个bug,它对应于phoenix-3.0.0-rc.0或ecto-2.0.0-rc.0包,因为当我使用{:ecto,==2.0.0-beta.2“,:phoenix_-ecto,“3.0.0-beta.2”}开关时,一切都正常工作。将此添加到config/config.ex中
config :adah, :ecto_repos, [Adah.Repo]
您是否尝试过执行错误建议您执行的操作:即添加配置?@michalmuskala,我不太确定应该向配置文件添加什么以及应该在哪个文件中添加它?到config.exs还是到dev.exs?我的意思是,不是有行已经在声明回购协议了?谢谢,这很有帮助,但是你能解释为什么需要它吗?你能包括更正文件的完整版本吗?OP的代码片段中已经有一行内容是
config:adah,adah.Repo
等。