Elixir 跨数据库外部配置失败
在Elixir 跨数据库外部配置失败,elixir,ecto,elixir-mix,Elixir,Ecto,Elixir Mix,在config/dev.exs中: config :drupex, Drupex.Repo, adapter: Ecto.Adapters.Postgres, -- username, password, database, hostname, pool_size omitted -- config :drupex, Drupex.DrupalRepo, adapter: Ecto.Adapters.Mysql, -- username, password, database,
config/dev.exs
中:
config :drupex, Drupex.Repo,
adapter: Ecto.Adapters.Postgres,
-- username, password, database, hostname, pool_size omitted --
config :drupex, Drupex.DrupalRepo,
adapter: Ecto.Adapters.Mysql,
-- username, password, database, hostname omitted --
在mix.exs
的defp deps do
下,我添加了{:mariaex,~>0.8.2},
就在{:postgrex,>=0.0.0}
之后。最后在lib/drupex/repo.ex中我添加了
defmodule Drupex.DrupalRepo do
use Ecto.Repo, otp_app: :drupex
end
我运行了mix deps.get
,mix deps.compile
现在运行mix
I get
** (ArgumentError) adapter Ecto.Adapters.Mysql was not compiled, ensure it is correct and it is included as a project dependency
事实证明,适配器名为MySQL
,并且区分大小写。更改为adapter:exto.Adapters.MySQL,
解决了这个问题。close参数无效,不是输入错误,而是Elixir是否区分大小写,适配器名称Postgres更难区分。仅供将来参考,任何以大写字母或冒号开头的“裸字”都是原子(exto.Adapters.MySql
和:ok
都是原子)。Elixir和Erlang中的原子区分大小写。提供了原子的大致情况。